Skip to main content
Glama

execute_service

Run AgentDesk marketplace services including AI code reviews, web scraping, and PDF generation by passing custom parameters through authenticated API requests.

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 with the MCP server, including name, description, and Zod input schema
    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()
      })
    )
  • Handler function that executes the service via HTTP POST to AgentDesk API with authentication using AGENTDESK_API_KEY
      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()
      })
    )
  • Zod schema defining input parameters for execute_service: service_id (string), input (record), and api_key (optional string)
    {
      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 helper function that wraps async tool handlers for MCP-compliant error handling, converting results to text content
    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?

With no annotations provided, the description carries full burden for behavioral disclosure but fails to indicate whether execution is destructive, idempotent, or what return format to expect. It mentions authentication requirements but contains inaccuracies (claiming AgentDesk key when the schema specifies Anthropic, and implying it is required when the schema marks it optional).

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 appropriately brief at three sentences, front-loading the core purpose in the first sentence. The final sentence ('Pass service-specific input parameters') is slightly redundant given the schema already documents this, but overall structure is efficient.

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 should disclose safety characteristics (destructive vs. read-only) and return value expectations for a marketplace execution tool. It omits both, and the contradiction regarding authentication requirements further undermines completeness.

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

Parameters2/5

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

Although the schema has 100% description coverage (baseline 3), the description introduces conflicting semantics for the 'api_key' parameter—describing it as an 'AgentDesk API key' when the schema specifies 'Anthropic API key', and implying it is required when it is optional per the required array. This creates confusion rather than additive value.

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 core action ('Execute a service') and the domain ('AgentDesk marketplace'), providing specific verb and resource identification. However, it does not explicitly differentiate when to use this generic execution tool versus sibling-specific tools like 'review_dual' or 'review_output'.

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?

While the description mentions an authentication requirement ('Requires an AgentDesk API key'), it provides no guidance on when to use this tool versus the specialized review siblings, nor does it clarify prerequisites beyond the API key. The authentication claim also contradicts the schema, which lists the API key as optional.

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