Skip to main content
Glama
tesla0225

MCP Create Server

by tesla0225

execute-tool

Run a specific tool on an MCP server by providing the server ID, tool name, and required arguments to automate tasks or processes.

Instructions

Execute a tool on a server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argsNoThe arguments to pass to the tool
serverIdYesThe ID of the server
toolNameYesThe name of the tool to execute

Implementation Reference

  • Main handler implementation in ServerManager class. Retrieves the connected server by ID and proxies the tool call to it using the MCP client.callTool method.
    async executeToolOnServer(
      serverId: string,
      toolName: string,
      args: Record<string, any>
    ): Promise<any> {
      const server = this.servers.get(serverId);
      if (!server) {
        throw new Error(`Server ${serverId} not found`);
      }
    
      try {
        // Call the tool on the server using the MCP client
        const result = await server.client.callTool({
          name: toolName,
          arguments: args,
        });
    
        return result;
      } catch (error) {
        console.error(`Error executing tool on server ${serverId}:`, error);
        throw error;
      }
    }
  • Dispatcher handler in the main CallToolRequest handler. Validates arguments and calls ServerManager.executeToolOnServer.
    case "execute-tool": {
      const args = request.params
        .arguments as unknown as ExecuteToolArgs;
      if (!args.serverId || !args.toolName) {
        throw new Error(
          "Missing required arguments: serverId and toolName"
        );
      }
    
      const result = await serverManager.executeToolOnServer(
        args.serverId,
        args.toolName,
        args.args || {}
      );
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(result),
          },
        ],
      };
    }
  • Tool object definition including name, description, and input schema for 'execute-tool'.
    const executeToolTool: Tool = {
      name: "execute-tool",
      description: "Execute a tool on a server",
      inputSchema: {
        type: "object",
        properties: {
          serverId: {
            type: "string",
            description: "The ID of the server",
          },
          toolName: {
            type: "string",
            description: "The name of the tool to execute",
          },
          args: {
            type: "object",
            description: "The arguments to pass to the tool",
          },
        },
        required: ["serverId", "toolName"],
      },
    };
  • TypeScript interface defining the input arguments for the execute-tool.
    interface ExecuteToolArgs {
      serverId: string;
      toolName: string;
      args: Record<string, any>;
    }
  • index.ts:1011-1022 (registration)
    Registration of the tool in the ListToolsRequest handler, where executeToolTool is included in the returned tools list.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      console.error("Received ListToolsRequest");
      return {
        tools: [
          createServerFromTemplateTool,
          executeToolTool,
          getServerToolsTool,
          deleteServerTool,
          listServersTool,
        ],
      };
    });
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 of behavioral disclosure. It states the action ('execute') but doesn't disclose traits like whether this is a read-only or destructive operation, authentication needs, rate limits, error handling, or what happens during execution (e.g., side effects, output format). For a tool with no annotations and potential mutation implications, this is a significant gap.

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

Conciseness4/5

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

The description is a single sentence with zero waste, making it appropriately sized and front-loaded. However, it's overly concise to the point of under-specification, lacking details that could help an agent use it effectively, which slightly reduces its utility.

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 the complexity of executing a tool (likely a mutation with side effects), no annotations, no output schema, and 3 parameters, the description is incomplete. It doesn't explain return values, error conditions, or behavioral context, leaving critical gaps for an agent to understand how to invoke it correctly.

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?

The schema description coverage is 100%, so the schema already documents all three parameters (args, serverId, toolName) with their types and descriptions. The description adds no meaning beyond this, such as explaining the structure of 'args' or how 'toolName' relates to available tools. 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.

Purpose3/5

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

The description states the action ('execute') and target ('a tool on a server'), which provides a basic purpose. However, it's vague about what 'execute' entails (e.g., running a script, command, or function) and doesn't distinguish from siblings like 'get-server-tools' (which likely lists tools) or 'delete-server' (which destroys resources). It avoids tautology by not merely restating the name.

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. It doesn't mention prerequisites (e.g., needing a valid server ID or tool name), exclusions, or how it relates to siblings like 'get-server-tools' (which might be needed first to identify tools). The description implies usage but offers no explicit context or comparisons.

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/tesla0225/mcp-create'

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