Skip to main content
Glama

get-table-schema

Retrieve the schema of a Xano database table to understand its structure and fields, available in markdown or JSON format.

Instructions

Browse the schema of a table

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
table_idYesID of the table to get schema from
formatNoOutput format: 'markdown' for readable documentation or 'json' for complete schemamarkdown

Implementation Reference

  • The handler function for the get-table-schema tool. It fetches the schema from Xano API using makeXanoRequest, then formats it as JSON or Markdown based on the format parameter, and returns structured content.
    async ({ table_id, format }) => {
      console.error(`[Tool] Executing get-table-schema for table ID: ${table_id} with format: ${format}`);
      try {
        const schema = await makeXanoRequest(`/workspace/${XANO_WORKSPACE}/table/${table_id}/schema`);
        
        if (format === "json") {
          // Return the complete JSON schema
          return {
            content: [
              {
                type: "text",
                text: `# Table Schema (Full JSON)\n\n\`\`\`json\n${JSON.stringify(schema, null, 2)}\n\`\`\``
              }
            ]
          };
        } else {
          // Format schema into readable structure
          const formattedContent = `# Schema for Table ID: ${table_id}\n\n` +
            (Array.isArray(schema) ? 
              schema.map(field => {
                let content = `## ${field.name} (${field.type})\n`;
                content += `**Required**: ${field.required ? 'Yes' : 'No'}\n`;
                content += `**Nullable**: ${field.nullable ? 'Yes' : 'No'}\n`;
                content += `**Access**: ${field.access || 'public'}\n`;
                content += `**Style**: ${field.style || 'single'}\n`;
                if (field.description) content += `**Description**: ${field.description}\n`;
                if (field.default !== undefined) content += `**Default**: ${field.default}\n`;
                if (field.config && Object.keys(field.config).length > 0) {
                  content += `**Config**:\n\`\`\`json\n${JSON.stringify(field.config, null, 2)}\n\`\`\`\n`;
                }
                if (field.validators && Object.keys(field.validators).length > 0) {
                  content += `**Validators**:\n\`\`\`json\n${JSON.stringify(field.validators, null, 2)}\n\`\`\`\n`;
                }
                if (field.children && field.children.length > 0) {
                  content += `**Children**:\n\`\`\`json\n${JSON.stringify(field.children, null, 2)}\n\`\`\`\n`;
                }
                return content;
              }).join('\n\n') : 
              `Error: Unexpected schema format: ${JSON.stringify(schema)}`
            );
    
          console.error(`[Tool] Successfully retrieved schema for table ID: ${table_id}`);
          return {
            content: [
              {
                type: "text",
                text: formattedContent
              }
            ]
          };
        }
      } catch (error) {
        console.error(`[Error] Failed to get table schema: ${error instanceof Error ? error.message : String(error)}`);
        return {
          content: [
            {
              type: "text",
              text: `Error getting table schema: ${error instanceof Error ? error.message : String(error)}`
            }
          ],
          isError: true
        };
      }
    }
  • Zod schema defining input parameters: table_id (string) and format (enum markdown/json, default markdown).
    {
      table_id: z.string().describe("ID of the table to get schema from"),
      format: z.enum(["markdown", "json"]).default("markdown").describe("Output format: 'markdown' for readable documentation or 'json' for complete schema")
    },
  • src/index.ts:180-251 (registration)
    The server.tool call that registers the get-table-schema tool, including its name, description, input schema, and handler function.
    server.tool(
      "get-table-schema",
      "Browse the schema of a table",
      {
        table_id: z.string().describe("ID of the table to get schema from"),
        format: z.enum(["markdown", "json"]).default("markdown").describe("Output format: 'markdown' for readable documentation or 'json' for complete schema")
      },
      async ({ table_id, format }) => {
        console.error(`[Tool] Executing get-table-schema for table ID: ${table_id} with format: ${format}`);
        try {
          const schema = await makeXanoRequest(`/workspace/${XANO_WORKSPACE}/table/${table_id}/schema`);
          
          if (format === "json") {
            // Return the complete JSON schema
            return {
              content: [
                {
                  type: "text",
                  text: `# Table Schema (Full JSON)\n\n\`\`\`json\n${JSON.stringify(schema, null, 2)}\n\`\`\``
                }
              ]
            };
          } else {
            // Format schema into readable structure
            const formattedContent = `# Schema for Table ID: ${table_id}\n\n` +
              (Array.isArray(schema) ? 
                schema.map(field => {
                  let content = `## ${field.name} (${field.type})\n`;
                  content += `**Required**: ${field.required ? 'Yes' : 'No'}\n`;
                  content += `**Nullable**: ${field.nullable ? 'Yes' : 'No'}\n`;
                  content += `**Access**: ${field.access || 'public'}\n`;
                  content += `**Style**: ${field.style || 'single'}\n`;
                  if (field.description) content += `**Description**: ${field.description}\n`;
                  if (field.default !== undefined) content += `**Default**: ${field.default}\n`;
                  if (field.config && Object.keys(field.config).length > 0) {
                    content += `**Config**:\n\`\`\`json\n${JSON.stringify(field.config, null, 2)}\n\`\`\`\n`;
                  }
                  if (field.validators && Object.keys(field.validators).length > 0) {
                    content += `**Validators**:\n\`\`\`json\n${JSON.stringify(field.validators, null, 2)}\n\`\`\`\n`;
                  }
                  if (field.children && field.children.length > 0) {
                    content += `**Children**:\n\`\`\`json\n${JSON.stringify(field.children, null, 2)}\n\`\`\`\n`;
                  }
                  return content;
                }).join('\n\n') : 
                `Error: Unexpected schema format: ${JSON.stringify(schema)}`
              );
    
            console.error(`[Tool] Successfully retrieved schema for table ID: ${table_id}`);
            return {
              content: [
                {
                  type: "text",
                  text: formattedContent
                }
              ]
            };
          }
        } catch (error) {
          console.error(`[Error] Failed to get table schema: ${error instanceof Error ? error.message : String(error)}`);
          return {
            content: [
              {
                type: "text",
                text: `Error getting table schema: ${error instanceof Error ? error.message : String(error)}`
              }
            ],
            isError: true
          };
        }
      }
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states 'browse' which implies a read-only operation, but doesn't disclose behavioral traits like whether it requires authentication, rate limits, or what happens if the table doesn't exist. This is a significant gap for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's appropriately sized and front-loaded, clearly stating the tool's purpose without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete. It doesn't explain what the output looks like (e.g., structure of schema information), behavioral constraints, or how it fits with sibling tools. For a tool with 2 parameters and no structured safety hints, this leaves too many gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters thoroughly. The description doesn't add any meaning beyond what's in the schema, such as explaining the implications of choosing 'markdown' vs 'json' format. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('browse') and resource ('schema of a table'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'edit-table-schema' or 'get-api-spec', which might have overlapping functionality or context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. With siblings like 'edit-table-schema' and 'list-tables', the description lacks context on prerequisites, such as needing a table ID from 'list-tables', or when to choose this over other schema-related tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/lowcodelocky2/xano-mcp'

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