get_node
Retrieve complete details of a specific Drupal node by providing its content type and ID. Fetch node information including related entities like images and authors for content management.
Instructions
Retrieve complete details of a specific Drupal node by its ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeType | Yes | The machine name of the content type (e.g., "article", "page", "blog_post") | |
| nodeId | Yes | The UUID or numeric ID of the node | |
| include | No | Related entities to include (e.g., ["field_image", "uid"] to include image and author) |
Implementation Reference
- src/drupal-client.ts:81-108 (handler)The actual implementation of the get_node tool functionality in the DrupalClient class.
async getNode( contentType: string, nodeId: string, include: string[] = [] ): Promise<DrupalNode> { try { const params: any = {}; // Include related entities if requested // Example: ['field_image', 'uid'] to include image and author if (include.length > 0) { params.include = include.join(','); } const response = await this.client.get<JsonApiResponse>( `/node/${contentType}/${nodeId}`, { params } ); // JSON:API returns single resource as object, not array return response.data.data as DrupalNode; } catch (error: any) { if (error.response?.status === 404) { throw new Error(`Node ${nodeId} not found`); } throw new Error(`Failed to get node: ${error.message}`); } } - src/index.ts:169-186 (handler)The MCP tool handler that routes the 'get_node' request to the DrupalClient method.
case 'get_node': { const typedArgs = args as unknown as GetNodeArgs; const node = await drupalClient.getNode( typedArgs.nodeType, typedArgs.nodeId, typedArgs.include || [] ); // Return full node data return { content: [ { type: 'text', text: JSON.stringify(node, null, 2), }, ], }; } - src/index.ts:68-90 (registration)Registration of the 'get_node' tool, including its schema definitions.
{ name: 'get_node', description: 'Retrieve complete details of a specific Drupal node by its ID', inputSchema: { type: 'object', properties: { nodeType: { type: 'string', description: 'The machine name of the content type (e.g., "article", "page", "blog_post")', }, nodeId: { type: 'string', description: 'The UUID or numeric ID of the node', }, include: { type: 'array', items: { type: 'string' }, description: 'Related entities to include (e.g., ["field_image", "uid"] to include image and author)', }, }, required: ['nodeType', 'nodeId'], }, },