Skip to main content
Glama
tim-mcdonnell

Tana MCP Server

create_plain_node

Adds a new plain node to a Tana workspace with specified name, description, and supertags, enabling structured data creation through the Tana Input API.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetNodeIdNo
nameYes
descriptionNo
supertagsNo

Implementation Reference

  • The main handler function for the 'create_plain_node' tool. It constructs a TanaPlainNode from inputs and delegates to TanaClient.createNode, returning the result or error in MCP format.
    async ({ targetNodeId, name, description, supertags }) => {
      try {
        const node: TanaPlainNode = {
          name,
          description,
          supertags
        };
    
        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 plain node: ${error instanceof Error ? error.message : String(error)}`
            }
          ],
          isError: true
        };
      }
    }
  • Zod schema defining the input parameters for the create_plain_node tool.
    {
      targetNodeId: z.string().optional(),
      name: z.string(),
      description: z.string().optional(),
      supertags: z.array(SupertagSchema).optional()
    },
  • Registration of the 'create_plain_node' tool using McpServer.tool() method.
    this.server.tool(
      'create_plain_node',
      {
        targetNodeId: z.string().optional(),
        name: z.string(),
        description: z.string().optional(),
        supertags: z.array(SupertagSchema).optional()
      },
      async ({ targetNodeId, name, description, supertags }) => {
        try {
          const node: TanaPlainNode = {
            name,
            description,
            supertags
          };
    
          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 plain node: ${error instanceof Error ? error.message : String(error)}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • TypeScript interface defining the structure of a plain node used in the handler.
    export interface TanaPlainNode extends TanaBaseNode {
      dataType?: 'plain';
    }
  • Helper method in TanaClient that performs the actual API call to create a single node.
    async createNode(targetNodeId: string | undefined, node: TanaNode): Promise<TanaNodeResponse> {
      const nodes = await this.createNodes(targetNodeId, [node]);
      if (nodes.length === 0) {
        throw new Error('Failed to create node');
      }
      return nodes[0];
    }

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