AI custom tools
Get AI Custom Tool Guide
Retrieve one focused MiniRacer authoring topic. Usually pass only topic. preset_id is optional and used only with topic=presets to load one live example; extra preset_id values on other topics are ignored. Requires admin credentials.
Parameters
topicstringoverviewpreambleentrypointsparametershttpllmraguploadschainsecretsdiscoursecontextcryptolimitssecuritypresetsoverviewFocused guide section. Use presets to browse or retrieve live preset examples.
preset_ idstringOptional live preset ID used only when topic=presets; ignored for every other topic.
List AI Custom Tools
List concise database-backed custom-tool summaries and compact live preset metadata. Scripts, bindings, verbose parameter descriptions, and full records are omitted; use discourse_ai_get_custom_tool or the guide's preset lookup to zoom in. Requires admin credentials.
Get AI Custom Tool
Get one database-backed scripted AI tool, including source and configured secret bindings. Treat the response as sensitive. Requires admin credentials.
Body
idinteger | stringrequiredCreate AI Custom Tool
Create a database-backed synchronous MiniRacer scripted tool. Call discourse_ai_get_custom_tool_guide before authoring. Never provide raw secret values. Requires admin credentials and write mode.
Body
namestringrequiredtool_ namestringrequireddescriptionstringrequiredsummarystringrequiredscriptstringrequiredparametersArray<object>secret_ contractsArray<object>secret_ bindingsArray<object>rag_ chunk_ tokensinteger[1, 50000]rag_ chunk_ overlap_ tokensinteger[0, 200]rag_ llm_ model_ idinteger | nullrag_ uploadsArray<object>Update AI Custom Tool
Partially update a scripted tool. Call the guide before substantial script changes. Omitted scalar fields and RAG uploads are preserved; changing secret_contracts can prune orphan bindings unless secret_bindings are supplied. Raw secret values are never accepted. Requires admin credentials and write mode.
Body
idinteger | stringrequirednamestringtool_ namestringdescriptionstringsummarystringscriptstringparametersArray<object>secret_ contractsArray<object>secret_ bindingsArray<object>rag_ chunk_ tokensinteger[1, 50000]rag_ chunk_ overlap_ tokensinteger[0, 200]rag_ llm_ model_ idinteger | nullrag_ uploadsArray<object>Delete AI Custom Tool
destructiveDelete a scripted tool. Agents referencing it may stop functioning as configured. Requires admin credentials and write mode.
Body
idinteger | stringrequiredTest AI Custom Tool
Actually execute a persisted or unsaved custom-tool script. It can make external requests and cause side effects; this is not dry validation. Requires admin credentials and write mode.
Body
idinteger | stringrequiredparametersobject[object Object]scriptstringsecret_ bindingsArray<object>Export AI Custom Tool
Export portable custom-tool JSON. Discourse excludes secret bindings; MCP also strips them defensively. Treat script source as sensitive. Requires admin credentials.
Body
idinteger | stringrequiredImport AI Custom Tool
destructiveImport portable custom-tool JSON. force overwrites a matching tool_name and requires confirm_force=true. Secret IDs may be bound, but raw secret values are never accepted. Requires admin credentials and write mode.
Body
ai_ toolobjectrequiredforcebooleanfalseconfirm_ forcebooleanfalse