Skip to main content
Glama

call_api

Execute API calls with configured authentication. Specify API endpoints and parameters to make requests through the JitAPI server.

Instructions

Execute an API call. Make sure authentication is configured first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_idYesThe API identifier
endpoint_idYesThe endpoint to call (e.g., 'GET /users/{id}')
path_paramsNoPath parameter values
query_paramsNoQuery parameter values
bodyNoRequest body for POST/PUT/PATCH

Implementation Reference

  • The _call_api method handles the execution of API calls, including endpoint retrieval, authentication checks, and the HTTP request execution.
    async def _call_api(self, args: dict[str, Any]) -> ToolResult:
        """Execute an API call."""
        api_id = args["api_id"]
        endpoint_id = args["endpoint_id"]
        path_params = args.get("path_params", {})
        query_params = args.get("query_params", {})
        body = args.get("body")
    
        # Get the endpoint
        endpoint = self.spec_store.get_endpoint(api_id, endpoint_id)
        if not endpoint:
            return ToolResult(
                success=False,
                data=None,
                error=f"Endpoint not found: {endpoint_id}",
            )
    
        # Check auth
        if not self.auth_handler.has_auth(api_id):
            return ToolResult(
                success=False,
                data=None,
                error=f"No authentication configured for API: {api_id}. Use set_api_auth first.",
            )
    
        # Execute the call
        result = await self.http_executor.call_endpoint(
            endpoint=endpoint,
            api_id=api_id,
            path_params=path_params,
            query_params=query_params,
            body=body,
        )
    
        return ToolResult(
            success=result.success,
            data={
                "status_code": result.status_code,
                "body": result.body,
                "headers": dict(result.headers),
            },
            error=result.error_message,
        )
  • The CallApiInput Pydantic model defines the schema and validation for the call_api tool arguments.
    class CallApiInput(BaseModel):
        """Input for call_api tool."""
    
        api_id: str = Field(
            ...,
            description="The API identifier",
            min_length=1,
        )
        endpoint_id: str = Field(
            ...,
            description="The endpoint to call",
            min_length=1,
        )
        path_params: dict[str, Any] = Field(
            default_factory=dict,
            description="Path parameter values",
        )
        query_params: dict[str, Any] = Field(
            default_factory=dict,
            description="Query parameter values",
        )
        body: dict[str, Any] | None = Field(
            None,
            description="Request body for POST/PUT/PATCH",
        )
  • Registration of the call_api tool handler within the tool mapping.
    "call_api": self._call_api,
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 mentions the auth prerequisite but fails to disclose that this tool makes external network requests, may have side effects depending on the HTTP method (POST/PUT/DELETE), or describe the response format. Significant gaps remain.

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?

Two sentences with zero waste: first states purpose, second states prerequisite. Efficiently front-loaded and appropriately sized for the information provided.

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?

For a tool with 5 parameters, nested objects, no output schema, and zero annotations, the description is insufficient. It omits what the tool returns, error handling behavior, and whether operations are potentially destructive (mutations possible via POST/PUT in endpoint_id).

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?

Input schema has 100% description coverage (all 5 parameters documented). The description adds no parameter-specific semantics, but baseline 3 is appropriate since the schema already comprehensively documents api_id, endpoint_id, path_params, query_params, and body.

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 uses specific verb 'Execute' and resource 'API call', clearly distinguishing this runtime/execution tool from sibling management tools like register_api, delete_api, and list_apis. However, it lacks explicit scope clarification (e.g., 'HTTP request to configured endpoints') that would make it a 5.

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

Usage Guidelines3/5

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

The description provides one critical prerequisite ('Make sure authentication is configured first'), implying it should be used after set_api_auth. However, it lacks explicit 'when to use vs when not to use' guidance or alternatives (e.g., 'use get_endpoint_schema to inspect before calling').

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/nk3750/jitapi'

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