Skip to main content
Glama

set-api-url

Use this tool to configure the API base URL for all requests in the PI API MCP Server, enabling secure access to PI Dashboard resources such as categories and charts.

Instructions

Set the API base URL for all requests

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesAPI base URL (e.g., http://localhost:8224/pi/api/v2)

Implementation Reference

  • The handler function for the 'set-api-url' tool. It validates the provided URL, sets the global API_BASE_URL variable, updates configuration flags, and returns a success or error message.
    }, async ({ url }) => { try { // Validate URL format try { new URL(url); } catch (e) { return { isError: true, content: [{ type: "text", text: `Invalid URL format. Please provide a valid URL including protocol (http:// or https://).` }] }; } API_BASE_URL = url; apiUrlSet = true; connectionVerified = false; return { content: [{ type: "text", text: `API URL set to: ${url}\n\nNext step: Please authenticate to start using the API.` }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `Error setting API URL: ${getErrorMessage(error)}` }] }; } });
  • Zod schema defining the input parameter 'url' as a string with description.
    url: z.string().describe("API base URL (e.g., http://localhost:8224/pi/api/v2)")
  • build/index.js:312-312 (registration)
    The server.tool call registering the 'set-api-url' tool with its name, description, schema, and inline handler function.
    server.tool("set-api-url", "Set the API base URL for all requests", {

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/mingzilla/pi-api-mcp-server'

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