Skip to main content
Glama

rr_request_approval

Request human approval for purchase orders by generating an approval link, enabling oversight in inventory management workflows.

Instructions

Request human approval for a PO (returns a link)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
po_idYes
messageNo

Implementation Reference

  • src/index.ts:50-50 (registration)
    Registration of the rr_request_approval tool in the TOOLS array.
    { name: 'rr_request_approval', description: 'Request human approval for a PO (returns a link)', inputSchema: { type: 'object' as const, properties: { po_id: { type: 'string' }, message: { type: 'string' } }, required: ['po_id'] } },
  • Generic handler for all tools, including rr_request_approval, which dispatches to callApi.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
      try {
        const result = await callApi(name, (args as Record<string, unknown>) || {});
        return {
          content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
        };
      } catch (error) {
        const message = error instanceof Error ? error.message : String(error);
        return {
          content: [{ type: 'text', text: `Error: ${message}` }],
          isError: true,
        };
      }
    });
  • Helper function that executes the actual tool logic by calling the remote API.
    async function callApi(toolName: string, input: Record<string, unknown>): Promise<unknown> {
      const resp = await fetch(`${BASE_URL}/api/mcp/call`, {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          'Authorization': `Bearer ${API_KEY}`,
        },
        body: JSON.stringify({ tool: toolName, input }),
      });
    
      if (!resp.ok) {
        const errorBody = await resp.text();
        throw new Error(`API error ${resp.status}: ${errorBody}`);
      }
    
      const data = await resp.json();
      return data.result;
    }

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/ReplenishRadar/MCP'

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