Skip to main content
Glama
apitable

AITable MCP Server

Official

list_spaces

Retrieve all accessible workspaces for the currently authenticated user using the AITable MCP Server. Facilitates workspace management and access control.

Instructions

Fetches all workspaces that the currently authenticated user has permission to access.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_spaces' MCP tool. It fetches workspaces from the AITable API endpoint '/v1/spaces', checks for success, formats the response with space definitions, handles errors, and returns MCP CallToolResult.
    async () => {
      try {
        const result: ResponseVO<{ spaces: SpaceVO[] }> = await aitableService.fetchFromAPI("/v1/spaces", {
          method: "GET",
        });
    
        if (!result.success) {
          console.error("Failed to fetch spaces:", result.message || "Unknown error");
          return formatToolResponse({
            success: false,
            message: result.message || "Failed to fetch spaces"
          }, true);
        }
    
        return formatToolResponse({
          success: true,
          data: {
            spaces: result.data.spaces,
            definitions: {
              id: "The workspace ID",
              name: "The name of the workspace",
              isAdmin: "Indicates if the user has admin permissions in the workspace"
            }
          }
        });
      }
      catch (error) {
        console.error("Error in list_spaces:", error);
        return formatToolResponse({
          success: false,
          message: error instanceof Error ? error.message : "Unknown error occurred"
        }, true);
      }
    }
  • src/index.ts:44-80 (registration)
    Registers the 'list_spaces' tool with the MCP server using server.tool(), providing a description and the inline handler function.
    server.tool("list_spaces",
      "Fetches all workspaces that the currently authenticated user has permission to access.",
      async () => {
        try {
          const result: ResponseVO<{ spaces: SpaceVO[] }> = await aitableService.fetchFromAPI("/v1/spaces", {
            method: "GET",
          });
    
          if (!result.success) {
            console.error("Failed to fetch spaces:", result.message || "Unknown error");
            return formatToolResponse({
              success: false,
              message: result.message || "Failed to fetch spaces"
            }, true);
          }
    
          return formatToolResponse({
            success: true,
            data: {
              spaces: result.data.spaces,
              definitions: {
                id: "The workspace ID",
                name: "The name of the workspace",
                isAdmin: "Indicates if the user has admin permissions in the workspace"
              }
            }
          });
        }
        catch (error) {
          console.error("Error in list_spaces:", error);
          return formatToolResponse({
            success: false,
            message: error instanceof Error ? error.message : "Unknown error occurred"
          }, true);
        }
      }
    );
  • Helper utility function to format the output of list_spaces (and other tools) into the required MCP CallToolResult structure with JSON content.
    const formatToolResponse = (data: unknown, isError = false): CallToolResult => {
      return {
        content: [{
          type: 'text',
          mimeType: 'application/json',
          text: JSON.stringify(data),
        }],
        isError,
      };
    };
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool fetches data, implying a read-only operation, but does not specify details like pagination, rate limits, authentication requirements beyond 'currently authenticated user', or error handling. This leaves significant gaps in understanding how the tool behaves in practice.

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, clear sentence that efficiently conveys the core functionality without unnecessary details. It is front-loaded with the main action and resource, making it easy to parse and understand quickly, with zero wasted words.

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

Completeness3/5

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

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is adequate but minimal. It covers the basic purpose but lacks depth on behavioral aspects like return format or error cases. For a read operation with no structured metadata, more context on output or usage scenarios would enhance completeness.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, meaning no parameters are documented in the schema. The description adds value by clarifying that no inputs are needed, as it fetches based on the user's permissions. This compensates well for the lack of parameters, though it could briefly mention any implicit assumptions.

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 action ('fetches') and resource ('workspaces'), specifying that it retrieves all workspaces accessible to the authenticated user. However, it does not differentiate from potential sibling tools like 'search_nodes' or 'list_records', which might also retrieve workspace-related data, leaving some ambiguity about uniqueness.

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?

The description implies usage when needing to access permitted workspaces but provides no explicit guidance on when to use this tool versus alternatives like 'search_nodes' or 'list_records'. It lacks context on prerequisites, exclusions, or comparisons with sibling tools, offering minimal directional help.

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

Related 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/apitable/aitable-mcp-server'

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