Skip to main content
Glama

execute_service

Execute marketplace services like AI review or web scraping to automate quality assurance. Provide service ID and input parameters; requires API key.

Instructions

Execute a service on the AgentDesk marketplace. Requires an AgentDesk API key for authentication. Pass service-specific input parameters.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
service_idYesService ID to execute (e.g., "review", "web_scrape", "realtime_jp", "pdf_generate", "summarize", "classify")
inputYesService-specific input parameters
api_keyNoBYOK: Your Anthropic API key (for AI-powered services like review)

Implementation Reference

  • src/index.ts:115-147 (registration)
    Registration of the 'execute_service' tool on the MCP server via server.tool(), defining its name, description, input schema, and handler.
    server.tool(
      'execute_service',
      'Execute a service on the AgentDesk marketplace. Requires an AgentDesk API key for authentication. Pass service-specific input parameters.',
      {
        service_id: z.string().describe('Service ID to execute (e.g., "review", "web_scrape", "realtime_jp", "pdf_generate", "summarize", "classify")'),
        input: z.record(z.unknown()).describe('Service-specific input parameters'),
        api_key: z.string().optional().describe('BYOK: Your Anthropic API key (for AI-powered services like review)'),
      },
      safeAsyncTool(async ({ service_id, input, api_key }) => {
        const agentdeskKey = process.env.AGENTDESK_API_KEY
        if (!agentdeskKey) {
          throw new Error('AGENTDESK_API_KEY environment variable is required for service execution.')
        }
    
        const body: Record<string, unknown> = { input }
        if (api_key) body.api_key = api_key
    
        const res = await fetch(`${AGENTDESK_API}/api/v1/services/${encodeURIComponent(service_id)}/execute`, {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
            'Authorization': `Bearer ${agentdeskKey}`,
          },
          body: JSON.stringify(body),
        })
    
        if (!res.ok) {
          const errorBody = await res.text()
          throw new Error(`API error ${res.status}: ${errorBody}`)
        }
        return await res.json()
      })
    )
  • Input schema for execute_service using Zod: service_id (string), input (record of unknown), and optional api_key.
    {
      service_id: z.string().describe('Service ID to execute (e.g., "review", "web_scrape", "realtime_jp", "pdf_generate", "summarize", "classify")'),
      input: z.record(z.unknown()).describe('Service-specific input parameters'),
      api_key: z.string().optional().describe('BYOK: Your Anthropic API key (for AI-powered services like review)'),
    },
  • Handler function for execute_service: reads AGENTDESK_API_KEY env var, POSTs to AgentDesk API with service_id and input, returns JSON result.
    safeAsyncTool(async ({ service_id, input, api_key }) => {
      const agentdeskKey = process.env.AGENTDESK_API_KEY
      if (!agentdeskKey) {
        throw new Error('AGENTDESK_API_KEY environment variable is required for service execution.')
      }
    
      const body: Record<string, unknown> = { input }
      if (api_key) body.api_key = api_key
    
      const res = await fetch(`${AGENTDESK_API}/api/v1/services/${encodeURIComponent(service_id)}/execute`, {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          'Authorization': `Bearer ${agentdeskKey}`,
        },
        body: JSON.stringify(body),
      })
    
      if (!res.ok) {
        const errorBody = await res.text()
        throw new Error(`API error ${res.status}: ${errorBody}`)
      }
      return await res.json()
    })
  • safeAsyncTool helper that wraps handler functions with MCP-compliant error handling (catches errors and returns isError response).
    function safeAsyncTool<T>(
      fn: (args: T) => Promise<string | object>
    ): (args: T) => Promise<{ content: { type: 'text'; text: string }[]; isError?: boolean }> {
      return async (args: T) => {
        try {
          const result = await fn(args)
          const text = typeof result === 'string' ? result : JSON.stringify(result, null, 2)
          return { content: [{ type: 'text' as const, text }] }
        } catch (e) {
          const message = e instanceof Error ? e.message : String(e)
          return {
            content: [{ type: 'text' as const, text: `Error: ${message}` }],
            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 of behavioral disclosure. It mentions only an authentication requirement (API key) but does not describe side effects (e.g., whether executing a service modifies state), idempotency, rate limits, or error conditions. The description is insufficient for an agent to understand what happens when the tool is invoked.

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 very concise at two sentences with no wasted words. However, it could be more informative within the same length by clarifying the service execution context or referencing the sibling tools. The front-loading is reasonable but the brevity sacrifices completeness.

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 lack of annotations and output schema, the description is insufficiently complete. It does not explain return values, error handling, or how to properly use the api_key parameter. For a tool with nested objects and no output schema, more context is needed to guide the agent effectively.

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 coverage is 100% as all parameters have descriptions. The description adds minimal value: it notes 'service-specific input parameters' but does not elaborate on how to structure the 'input' object for different service IDs. The api_key parameter is described in the schema as 'BYOK: Your Anthropic API key', while the description mentions an 'AgentDesk API key', causing slight inconsistency. Overall, the description does little beyond what the schema already provides.

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 ('Execute a service') and the resource ('AgentDesk marketplace'), providing a specific verb+resource pair. However, it does not distinguish this tool from its siblings (list_services, review_dual, review_output), which could lead to confusion about when to use this generic service execution tool versus those specialized tools.

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 mentions requiring an API key and passing service-specific input, but provides no guidance on when to use this tool versus alternatives like list_services or review_dual. There is no mention of prerequisites (e.g., selecting a service from list_services first) or when not to use this tool. The phrase 'service-specific input parameters' lacks detail on how to determine which parameters are appropriate for a given service_id.

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/Rih0z/agentdesk-mcp'

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