Skip to main content
Glama

PostOrdersIdTransferAccept

Accept a transfer request to move an order to a customer's account, completing the transfer process initiated by either the customer or admin.

Instructions

Accept an order to be transfered to a customer's account, which was specified when the transfer request was created. The transfer is requested previously either by the customer using the Request Order Transfer Store API route, or by the admin using the Request Order Transfer Admin API route.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNo
fieldsNo

Implementation Reference

  • The core handler logic for the 'PostOrdersIdTransferAccept' tool. This generic handler is used for all tools generated from the store OpenAPI spec. It constructs query parameters and body from input, then calls the Medusa JS SDK's client.fetch method on the appropriate API path.
        handler: async (
            input: InferToolHandlerInput<any, ZodTypeAny>
        ): Promise<any> => {
            const query = new URLSearchParams(input);
            const body = Object.entries(input).reduce(
                (acc, [key, value]) => {
                    if (
                        parameters.find(
                            (p) => p.name === key && p.in === "body"
                        )
                    ) {
                        acc[key] = value;
                    }
                    return acc;
                },
                {} as Record<string, any>
            );
            if (method === "get") {
                console.error(
                    `Fetching ${refPath} with GET ${query.toString()}`
                );
                const response = await this.sdk.client.fetch(refPath, {
                    method: method,
                    headers: {
                        "Content-Type": "application/json",
                        "Accept": "application/json",
                        "Authorization": `Bearer ${process.env.PUBLISHABLE_KEY}`
                    },
                    query: query
                });
                return response;
            } else {
                const response = await this.sdk.client.fetch(refPath, {
                    method: method,
                    headers: {
                        "Content-Type": "application/json",
                        "Accept": "application/json",
                        "Authorization": `Bearer ${process.env.PUBLISHABLE_KEY}`
                    },
                    body: JSON.stringify(body)
                });
                return response;
            }
        }
    };
  • The input schema for the tool, dynamically generated from the OpenAPI specification parameters (excluding headers), using Zod for validation based on parameter types.
    inputSchema: {
        ...parameters
            .filter((p) => p.in != "header")
            .reduce((acc, param) => {
                switch (param.schema.type) {
                    case "string":
                        acc[param.name] = z.string().optional();
                        break;
                    case "number":
                        acc[param.name] = z.number().optional();
                        break;
                    case "boolean":
                        acc[param.name] = z.boolean().optional();
                        break;
                    case "array":
                        acc[param.name] = z
                            .array(z.string())
                            .optional();
                        break;
                    case "object":
                        acc[param.name] = z.object({}).optional();
                        break;
                    default:
                        acc[param.name] = z.string().optional();
                }
                return acc;
            }, {} as any)
    },
  • src/index.ts:35-42 (registration)
    Registration of all tools from medusaStoreService.defineTools() (including 'PostOrdersIdTransferAccept') into the MCP server using server.tool().
    tools.forEach((tool) => {
        server.tool(
            tool.name,
            tool.description,
            tool.inputSchema,
            tool.handler
        );
    });
  • src/index.ts:15-17 (registration)
    Collection of tools list where medusaStoreService.defineTools() adds the 'PostOrdersIdTransferAccept' tool.
        ...medusaStoreService.defineTools(),
        ...medusaAdminService.defineTools()
    ];
  • The defineTools method that iterates over OpenAPI paths and creates tool definitions using wrapPath, including the one for operationId 'PostOrdersIdTransferAccept'.
    defineTools(store = storeJson): any[] {
        const paths = Object.entries(store.paths) as [string, SdkRequestType][];
        const tools = paths.map(([path, refFunction]) =>
            this.wrapPath(path, refFunction)
        );
        return tools;
    }
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. It mentions that this tool 'accepts' a transfer, implying a mutation, but doesn't disclose behavioral traits such as required permissions, whether the action is reversible, error conditions, or rate limits. This leaves significant gaps in understanding the tool's behavior.

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 sized with two sentences that efficiently explain the tool's purpose and prerequisite context. It avoids unnecessary details and is front-loaded with the main action, though it could be slightly more concise by integrating the prerequisite information more tightly.

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 a mutation tool with no annotations, 2 undocumented parameters, and no output schema, the description is incomplete. It covers the purpose and prerequisites but lacks details on parameters, return values, error handling, and behavioral constraints, making it insufficient for safe and effective use.

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?

The input schema has 2 parameters (id and fields) with 0% description coverage, and the tool description provides no information about what these parameters mean, their formats, or how they should be used. This fails to compensate for the lack of schema documentation, leaving parameters largely unexplained.

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 verb 'accept' and the resource 'an order to be transferred to a customer's account', making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like PostOrdersIdTransferCancel or PostOrdersIdTransferDecline beyond mentioning the action of acceptance.

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

Usage Guidelines4/5

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

The description provides clear context by explaining that the transfer must have been previously requested via specific API routes (store or admin), indicating when this tool is applicable. It doesn't explicitly state when not to use it or name alternatives like the decline or cancel tools, but the prerequisite context is well-defined.

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/SGFGOV/medusa-mcp'

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