capacities_search
Search content across Capacities knowledge management spaces with optional filtering by space, structure, or search mode to find specific information.
Instructions
Search for content across Capacities spaces with optional filtering
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| searchTerm | Yes | The search term to look for | |
| spaceIds | Yes | Array of space UUIDs to search in | |
| mode | No | Search mode: fullText or title only | title |
| filterStructureIds | No | Optional array of structure IDs to filter results |
Implementation Reference
- src/tools/search.ts:12-39 (handler)The main handler function that constructs the search request body and calls the Capacities API search endpoint.execute: async (args: { searchTerm: string; spaceIds: string[]; mode?: "fullText" | "title"; filterStructureIds?: string[]; }) => { try { const requestBody = { searchTerm: args.searchTerm, spaceIds: args.spaceIds, ...(args.mode && { mode: args.mode }), ...(args.filterStructureIds && { filterStructureIds: args.filterStructureIds, }), }; const response = await makeApiRequest("/search", { method: "POST", body: JSON.stringify(requestBody), }); const data = await response.json(); return JSON.stringify(data, null, 2); } catch (error) { throw new Error( `Failed to search content: ${error instanceof Error ? error.message : String(error)}`, ); }
- src/tools/search.ts:42-56 (schema)Zod schema defining the input parameters: searchTerm, spaceIds, optional mode and filterStructureIds.parameters: z.object({ searchTerm: z.string().describe("The search term to look for"), spaceIds: z .array(z.string().uuid()) .describe("Array of space UUIDs to search in"), mode: z .enum(["fullText", "title"]) .optional() .describe("Search mode: fullText or title only") .default("title"), filterStructureIds: z .array(z.string().uuid()) .optional() .describe("Optional array of structure IDs to filter results"), }),
- src/server.ts:27-27 (registration)Registers the capacities_search tool (imported as searchTool) with the FastMCP server.server.addTool(searchTool);
- src/api.ts:11-36 (helper)Helper function used by the handler to make authenticated POST requests to the Capacities API.export async function makeApiRequest( endpoint: string, options: RequestInit = {}, ): Promise<Response> { const apiKey = getApiKey(); const requestOptions = { ...options, headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json", ...options.headers, }, }; const response = await fetch(`${API_BASE_URL}${endpoint}`, requestOptions); if (!response.ok) { const errorText = await response.text(); throw new Error( `Capacities API error: ${response.status} ${response.statusText} - ${errorText}`, ); } return response; }