fix: tools/list handler now returns proper tool metadata
Issue: The registerTool method was receiving description and inputSchema parameters but marking them as unused (_description, _inputSchema) and not storing them with the handler. This caused tools/list to return tools without their description and inputSchema properties. Fix: Remove underscore prefixes and explicitly set these properties on the handler object before storing it in the tools Map. Now tools/list will properly return: - name: Tool name - description: Tool description (from registerTool call) - inputSchema: Tool input schema (from registerTool call) This ensures MCP clients can see proper tool documentation and schemas. Files changed: - src/server.ts: Fixed registerTool to preserve metadata Build: ✅ 0 errors Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -42,10 +42,14 @@ export class ObsidianMCPServer {
|
||||
*/
|
||||
registerTool(
|
||||
name: string,
|
||||
_description: string,
|
||||
_inputSchema: Record<string, unknown>,
|
||||
description: string,
|
||||
inputSchema: Record<string, unknown>,
|
||||
handler: ToolHandler
|
||||
): void {
|
||||
// Ensure handler has description and inputSchema
|
||||
handler.description = description;
|
||||
handler.inputSchema = inputSchema;
|
||||
|
||||
this.tools.set(name, handler);
|
||||
logger.debug('Registered tool', { name });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user