Skip to main content
Glama

cancel_order

Cancel an open cryptocurrency trading order by its unique ID within the pexbot-mcp simulated exchange environment.

Instructions

Cancel an open order by its ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
order_idYesUUID of the order to cancel

Implementation Reference

  • The handler function that executes the cancel_order tool logic. It calls the API DELETE endpoint for the specified order_id and returns the result as JSON.
    async ({ order_id }) => {
      const data = await apiDelete<unknown>(`/orders/${order_id}`);
      return {
        content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }],
      };
    }
  • Zod schema definition for cancel_order input validation. Defines order_id as a required string parameter with description.
    { order_id: z.string().describe("UUID of the order to cancel") },
  • src/index.ts:371-381 (registration)
    Registration of the cancel_order tool with the MCP server. Includes tool name, description, schema, and handler function.
    server.tool(
      "cancel_order",
      "Cancel an open order by its ID.",
      { order_id: z.string().describe("UUID of the order to cancel") },
      async ({ order_id }) => {
        const data = await apiDelete<unknown>(`/orders/${order_id}`);
        return {
          content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }],
        };
      }
    );
  • Helper function apiDelete that performs HTTP DELETE requests to the API. Used by the cancel_order handler to make the actual API call.
    async function apiDelete<T>(path: string): Promise<T> {
      const res = await fetch(`${API_BASE}${path}`, {
        method: "DELETE",
        headers: getAuthHeaders(),
      });
      if (!res.ok) {
        const text = await res.text();
        throw new Error(`API DELETE ${path} failed (${res.status}): ${text}`);
      }
      return res.json() as Promise<T>;
    }
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 tool cancels orders but does not address critical aspects like permission requirements, whether cancellation is reversible, rate limits, or error conditions. This is a significant gap for a mutation tool.

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, efficient sentence that front-loads the core action ('cancel an open order') without unnecessary words. Every part of the sentence contributes directly to understanding the tool's purpose.

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 tool's complexity (a mutation with no annotations or output schema), the description is incomplete. It lacks details on behavioral traits, error handling, and return values, which are essential for safe and effective use by an AI agent.

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 description coverage is 100%, with the parameter 'order_id' fully documented as a UUID. The description adds no additional semantic context beyond what the schema provides, such as format examples or validation rules, so it meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

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

The description clearly states the specific action ('cancel') and resource ('an open order by its ID'), distinguishing it from siblings like 'place_order' or 'get_orderbook'. It precisely communicates what the tool does without being vague or tautological.

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 implies usage context by specifying 'open order', suggesting it should not be used for closed or non-existent orders. However, it does not explicitly state when to use alternatives (e.g., 'get_my_runs' to check order status) or provide clear exclusions, leaving some ambiguity.

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/mikusnuz/pexbot-mcp'

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