Skip to main content
Glama
tim-mcdonnell

Tana MCP Server

create_reference_node

Create a reference node in Tana workspaces by linking to existing nodes using target and reference IDs, enabling structured data connections.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetNodeIdNo
referenceIdYes

Implementation Reference

  • The main handler function for the 'create_reference_node' tool. It constructs a TanaReferenceNode with the provided referenceId and creates it under the optional targetNodeId using the tanaClient.
    async ({ targetNodeId, referenceId }) => {
      try {
        const node: TanaReferenceNode = {
          dataType: 'reference',
          id: referenceId
        };
    
        const result = await this.tanaClient.createNode(targetNodeId, node);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result, null, 2)
            }
          ],
          isError: false
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error creating reference node: ${error instanceof Error ? error.message : String(error)}`
            }
          ],
          isError: true
        };
      }
  • Zod schema defining the input parameters: optional targetNodeId (string) and required referenceId (string).
    {
      targetNodeId: z.string().optional(),
      referenceId: z.string()
  • Registration of the 'create_reference_node' tool using this.server.tool(), including schema and inline handler.
    this.server.tool(
      'create_reference_node',
      {
        targetNodeId: z.string().optional(),
        referenceId: z.string()
      },
      async ({ targetNodeId, referenceId }) => {
        try {
          const node: TanaReferenceNode = {
            dataType: 'reference',
            id: referenceId
          };
    
          const result = await this.tanaClient.createNode(targetNodeId, node);
    
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(result, null, 2)
              }
            ],
            isError: false
          };
        } catch (error) {
          return {
            content: [
              {
                type: 'text',
                text: `Error creating reference node: ${error instanceof Error ? error.message : String(error)}`
              }
            ],
            isError: true
          };
        }
      }
    );

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/tim-mcdonnell/tana-mcp'

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