feat: add get_node_help tool to retrieve node documentation#17
feat: add get_node_help tool to retrieve node documentation#17woytekbode wants to merge 2 commits into
Conversation
Adds a new `get_node_help` tool that fetches the HTML help/documentation for a specific node type via the Node-RED Admin API. The Node-RED Admin API's GET /nodes/:module/:set endpoint returns HTML help content when requested with Accept: text/html. This is the same documentation shown in the Node-RED editor's info sidebar when selecting a node. This tool makes that documentation accessible to AI assistants, enabling them to understand node behavior, input/output formats, and configuration options. Changes: - src/client.ts: Add getNodeHelp(module, set) method - src/tools/get-node-help.ts: New tool handler - src/server.ts: Register get_node_help tool - tests/client-runtime.test.ts: Add client method tests - tests/tools-runtime.test.ts: Add tool handler tests - tests/server.test.ts: Add tool to listing assertion - README.md: Document new tool in features list
There was a problem hiding this comment.
Pull request overview
Adds a new MCP tool, get_node_help, to fetch Node-RED node HTML documentation (the same content shown in the editor info sidebar) via the Node-RED Admin API.
Changes:
- Add
NodeRedClient.getNodeHelp(module, set)that requestsGET /nodes/:module/:setwithAccept: text/html. - Add a new tool handler
src/tools/get-node-help.tsand register it insrc/server.tsasget_node_help. - Add/adjust tests and update README feature list + examples.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/client.ts |
Adds getNodeHelp() client method that fetches HTML help from the Admin API. |
src/tools/get-node-help.ts |
New tool handler that returns the HTML as MCP text content. |
src/server.ts |
Registers the new get_node_help tool and routes calls to the handler. |
tests/client-runtime.test.ts |
Adds tests for the new client method (success + error cases). |
tests/tools-runtime.test.ts |
Adds tests for the new tool handler output. |
tests/server.test.ts |
Updates tool listing assertion to include get_node_help. |
README.md |
Updates tool count/features list and adds a usage example prompt. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| export async function getNodeHelp( | ||
| client: NodeRedClient, | ||
| args: { module: string; set: string } | ||
| ) { | ||
| const result = await client.getNodeHelp(args.module, args.set); |
| case 'get_nodes': | ||
| return await getNodes(client); | ||
| case 'get_node_help': | ||
| return await getNodeHelp(client, request.params.arguments as { module: string; set: string }); |
| async getNodeHelp(module: string, set: string): Promise<string> { | ||
| const headers = this.getHeaders(); | ||
| headers.Accept = 'text/html'; | ||
| const response = await request(`${this.baseUrl}/nodes/${module}/${set}`, { | ||
| method: 'GET', |
|
Hi @fx. This is a lazy PR, straight from Claude via Github MCP. I'm not a true developer but I would like to use this MCP server to work on my Node Red home automation with Claude. However, from what I have seen, it appears Claude is unable to get node help docs, which would help properly set up new flows or edit existing flows/nodes. Therefore, I have decided to at least make clear my goals. Maybe this PR helps, maybe it does not. That's your call. If you agree with the above, would you be willing to help me add a get-node-help function? |
- Add Zod schema validation in get-node-help tool handler (args: unknown) - Remove type assertion in server.ts switch case - URL-encode module and set path segments with encodeURIComponent() - Add test for scoped package URL encoding - Add test for invalid argument rejection
Adds a new
get_node_helptool that fetches the HTML help/documentation for a specific node type via the Node-RED Admin API.The Node-RED Admin API's GET /nodes/:module/:set endpoint returns HTML help content when requested with Accept: text/html. This is the same documentation shown in the Node-RED editor's info sidebar when selecting a node. This tool makes that documentation accessible to AI assistants, enabling them to understand node behavior, input/output formats, and configuration options.
Changes: