search_documentation
Find VeChain documentation, API references, and code examples by searching across official guides and resources to answer development questions.
Instructions
Search across the documentation to find relevant information, code examples, API references, and guides. Use this tool when you need to answer questions about VeChain Docs, find specific documentation, understand how features work, or locate implementation details. The search returns contextual content with titles and direct links to the documentation pages.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The search query string |
Implementation Reference
- src/tools.ts:37-71 (handler)The callback function that executes the tool logic. It proxies the search query to the VeChain documentation MCP server by calling its 'searchDocumentation' tool.callback: async ({ query }: { query: string }) => { try { const vechainDocsMcpClient = await createVechainDocsMcpClient(); const response = await vechainDocsMcpClient.client.callTool({ name: "searchDocumentation", arguments: { query } }) return { content: [ { type: "text", text: JSON.stringify(response, null, 2), }, ], }; } catch (err) { const isAbort = (err as Error)?.name === "AbortError"; return { content: [ { type: "text", text: JSON.stringify( { error: isAbort ? "Request timed out" : "Failed to fetch account", reason: String((err as Error)?.message ?? err), }, null, 2 ), }, ], }; } }
- src/tools.ts:34-36 (schema)Zod input schema definition for the tool, specifying the 'query' parameter.inputSchema: { query: z.string().describe("The search query string"), },
- src/server.ts:74-92 (registration)Registers all tools from the vechainTools array (including 'search_documentation') with the MCP server using their predefined properties and callbacks.for (const t of vechainTools) { server.registerTool( t.name, { title: t.name, description: t.description, inputSchema: t.inputSchema }, async (args) => { const result = await t.callback(args); return { content: result.content.map(item => ({ ...item, type: "text" as const })) }; } ); }
- src/client.ts:39-47 (helper)Helper function used by the handler to create an MCP client connected to the VeChain documentation server for proxying the search request.export async function createVechainDocsMcpClient() { try { const vechainDocsMcpClient = await createGitbookMcpClient(vechainConfig.mcpClient.vechainDocsUrl); return vechainDocsMcpClient } catch (err) { console.error("Error creating VeChain Docs MCP Client:", err); throw err; } }
- src/tools.ts:30-72 (registration)Tool object definition in vechainTools array, which includes name, schema, description, and handler reference for registration.{ name: "search_documentation", title: "Search VeChain Documentation", description: "Search across the documentation to find relevant information, code examples, API references, and guides. Use this tool when you need to answer questions about VeChain Docs, find specific documentation, understand how features work, or locate implementation details. The search returns contextual content with titles and direct links to the documentation pages.", inputSchema: { query: z.string().describe("The search query string"), }, callback: async ({ query }: { query: string }) => { try { const vechainDocsMcpClient = await createVechainDocsMcpClient(); const response = await vechainDocsMcpClient.client.callTool({ name: "searchDocumentation", arguments: { query } }) return { content: [ { type: "text", text: JSON.stringify(response, null, 2), }, ], }; } catch (err) { const isAbort = (err as Error)?.name === "AbortError"; return { content: [ { type: "text", text: JSON.stringify( { error: isAbort ? "Request timed out" : "Failed to fetch account", reason: String((err as Error)?.message ?? err), }, null, 2 ), }, ], }; } } },