Skip to main content
Glama

search_nodes

Find specific nodes in Workflowy by entering search queries to locate relevant content quickly.

Instructions

Search nodes in Workflowy

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query to find matching nodes

Implementation Reference

  • MCP tool handler for 'search_nodes'. Calls workflowyClient.search and returns JSON results or error message.
    handler: async ({ query, username, password }: { query: string, username?: string, password?: string }, client: typeof workflowyClient) => { try { const items = await workflowyClient.search(query, username, password); return { content: [{ type: "text", text: JSON.stringify(items, null, 2) }] }; } catch (error: any) { return { content: [{ type: "text", text: `Error searching nodes: ${error.message}` }] }; } }
  • Input schema for search_nodes tool defining the 'query' parameter.
    inputSchema: { query: z.string().describe("Search query to find matching nodes") },
  • Core implementation of node search using stack-based traversal of the Workflowy document tree to find matching node names.
    async search(query: string, username?: string, password?: string) { const { wf } = await this.createAuthenticatedClient(username, password); const t = await wf.getDocument(); const items = t.root.items; let results = []; let stack = [...t.root.items]; while (stack.length > 0) { const current = stack.pop(); if (current!.name.toLowerCase().includes(query.toLowerCase())) { results.push(current!.toJson()); } if (current!.items) { stack.push(...current!.items); } } // need to traverse the tree to find all items return results }
  • Function that registers all tools from toolRegistry (including search_nodes) with the MCP server.
    export function registerTools(server: FastMCP): void { Object.entries(toolRegistry).forEach(([name, tool]) => { server.addTool({ name, description: tool.description, parameters: z.object(tool.inputSchema), annotations: tool.annotations, execute: tool.handler }); }); }
  • src/index.ts:14-14 (registration)
    Invokes tool registration for the MCP server startup.
    registerTools(server);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/danield137/mcp-workflowy'

If you have feedback or need assistance with the MCP directory API, please join our Discord server