Execute Tool
Execute one of Sharely.ai's first-party agent tools over REST. This gives non-TypeScript agents the same knowledge primitives the Server SDK exposes — search, retrieval, taxonomy browsing, and workspace metadata — with RBAC applied server-side.
POST /v1/workspaces/{workspaceId}/agent/tools/{name}/executeRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
input | object | Yes | Tool-specific input (see catalog below) |
context | object | No | Execution context |
context.spaceId | UUID | No | Scope to a space |
context.userId | UUID | No | Acting user |
context.roleId | UUID | No | RBAC role to scope results to (validated against workspace roles) |
context.languageId | string | No | Knowledge language filter (e.g. en, es) |
context.topK | number | No | Result limit hint (min 1, max 50) |
Response (200 OK)
{
"output": { /* tool-specific output */ },
"sources": [ /* optional citation objects */ ]
}If the tool itself fails, the response includes an error field instead of throwing:
{ "output": null, "error": "Knowledge item not found" }Errors
400- Invalid input for the tool's schema404- Unknown tool name, workspace not found, orcontext.roleIdnot found
Tool Catalog
semantic_search
Vector search over workspace knowledge. Backed by the same engine as RAG Query, with output shaped for agent loops.
Input:
| Field | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Query text |
topK | number | No | Min 1, max 10, default 10 |
languageId | string | No | Knowledge language filter |
Output: knowledgeResults (scored passages with id, score, text, title, source, knowledgeId, language), plus a sources citation array suitable for the sources field when storing messages.
curl -X POST \
'https://api.sharely.ai/v1/workspaces/{workspaceId}/agent/tools/semantic_search/execute' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{ "input": { "text": "refund policy", "topK": 5 } }'search_knowledge
Keyword search over knowledge items.
Input:
| Field | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Search term |
limit | number | No | Min 1, max 50, default 10 |
Output: knowledgeResults — items with id, type, title, content, and file metadata (filename, mimetype) where applicable.
get_knowledge_item
Retrieve a single knowledge item with its content items.
Input:
| Field | Type | Required | Description |
|---|---|---|---|
knowledgeId | UUID | Yes | The knowledge item |
itemId | UUID | No | A specific content item within it |
Output: knowledge (id, type, content, metadata) and items (content chunks).
list_taxonomies
Input: limit (number, optional, default 10)
Output: taxonomies — [{ "id", "name", "status" }] where status is DRAFT or PUBLISHED.
get_taxonomy_knowledge
Input: taxonomyId (UUID, required)
Output: categories — each with id, name, and its assigned knowledges ([{ "id", "title" }]).
get_workspace_stats
Input: none ("input": {})
Output:
{ "totalKnowledge": 1240, "totalSpaces": 87, "totalThreads": 342 }list_roles
Input: none ("input": {})
Output: roles — [{ "id", "name", "description" }].
RBAC Notes
- Pass
context.roleIdto scope results to a role; with workspace RBAC active, tools filter knowledge to that role's assignments - The same tool definitions ship in
@sharelyai/toolsas JSON-schema specs for Anthropic, OpenAI, Vercel AI SDK, and LangChain tool-use loops
Related
- Tools & Platform Client - Using these tools from the Server SDK
- RAG Query - The lower-level retrieval endpoint