Skip to main content
Glama
tim-mcdonnell

Tana MCP Server

create_url_node

Add web links to Tana workspaces by creating URL nodes with descriptions and tags for organized reference.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetNodeIdNo
urlYes
descriptionNo
supertagsNo

Implementation Reference

  • The core handler function for the 'create_url_node' tool. It constructs a TanaUrlNode object from the input parameters and delegates the creation to the TanaClient's createNode method, returning the result or error in MCP format.
      async ({ targetNodeId, url, description, supertags }) => {
        try {
          const node: TanaUrlNode = {
            dataType: 'url',
            name: url,
            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 URL node: ${error instanceof Error ? error.message : String(error)}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • Zod input schema for the create_url_node tool, validating optional targetNodeId, required valid URL, optional description, and optional array of supertags.
    {
      targetNodeId: z.string().optional(),
      url: z.string().url(),
      description: z.string().optional(),
      supertags: z.array(SupertagSchema).optional()
    },
  • The registration of the 'create_url_node' tool on the MCP server within the registerTools method, including the tool name, input schema, and inline handler function.
      'create_url_node',
      {
        targetNodeId: z.string().optional(),
        url: z.string().url(),
        description: z.string().optional(),
        supertags: z.array(SupertagSchema).optional()
      },
      async ({ targetNodeId, url, description, supertags }) => {
        try {
          const node: TanaUrlNode = {
            dataType: 'url',
            name: url,
            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 URL node: ${error instanceof Error ? error.message : String(error)}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • TypeScript interface definition for TanaUrlNode, which defines the structure used when creating URL nodes in the handler.
    export interface TanaUrlNode extends TanaBaseNode {
      dataType: 'url';
      name: string; // URL string
    }
  • Zod schema for supertags, used in the input schema for supertags array in create_url_node.
    const SupertagSchema = z.object({
      id: z.string(),
      fields: z.record(z.string()).optional()
    });

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