Skip to main content
Glama

check-connection

Verify API URL and authentication validity to ensure secure access to PI Dashboard resources.

Instructions

Check if the current API URL and authentication are valid

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'check-connection' tool. It checks if API URL and auth token are configured, calls verifyConnection() to test the API, and returns success or error messages.
    server.tool("check-connection", "Check if the current API URL and authentication are valid", {}, async () => {
        try {
            if (!apiUrlSet || !API_BASE_URL) {
                return {
                    content: [{
                            type: "text",
                            text: "API URL not set. Please set the API URL using the set-api-url tool."
                        }]
                };
            }
            if (!authToken) {
                return {
                    content: [{
                            type: "text",
                            text: "Not authenticated. Please authenticate using the authenticate tool."
                        }]
                };
            }
            // Verify the connection
            const isConnected = await verifyConnection();
            if (isConnected) {
                return {
                    content: [{
                            type: "text",
                            text: `✅ Connection successful! The API URL and token are valid. You're ready to use the PI API.`
                        }]
                };
            }
            else {
                return {
                    isError: true,
                    content: [{
                            type: "text",
                            text: `❌ Connection failed. The token might be invalid or expired. Please try to authenticate again.`
                        }]
                };
            }
        }
        catch (error) {
            return {
                isError: true,
                content: [{ type: "text", text: `Connection check failed: ${getErrorMessage(error)}` }]
            };
        }
    });
  • build/index.js:263-263 (registration)
    Registers the 'check-connection' tool on the MCP server with empty input schema (no parameters required).
    server.tool("check-connection", "Check if the current API URL and authentication are valid", {}, async () => {
  • Helper function verifyConnection() called by the check-connection handler to test the API connection via /tokens/keepAlive endpoint.
    async function verifyConnection() {
        if (!apiUrlSet || !API_BASE_URL) {
            return false;
        }
        if (!authToken) {
            return false;
        }
        try {
            // Try a lightweight request to verify the connection
            await authenticatedRequest("/tokens/keepAlive", "POST");
            connectionVerified = true;
            return true;
        }
        catch (error) {
            logError(`Connection verification failed: ${getErrorMessage(error)}`);
            connectionVerified = false;
            return false;
        }
    }
  • Input schema for check-connection tool: empty object, indicating no input parameters are required.
    server.tool("check-connection", "Check if the current API URL and authentication are valid", {}, async () => {
Behavior3/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 states the tool checks validity, implying a read-only, non-destructive operation, but does not detail response format, error conditions, or rate limits. It adequately describes the core behavior but lacks richer context.

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 directly states the tool's purpose without unnecessary words. It is front-loaded with the core action and target, making it easy to understand quickly with zero waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 params, no annotations, no output schema), the description is complete enough for basic understanding. However, it could benefit from additional context like what 'valid' means (e.g., connectivity, auth status) or typical use cases, leaving some gaps in full contextual coverage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so no parameter documentation is needed. The description does not add parameter details beyond the schema, but this is appropriate given the lack of parameters, aligning with the baseline expectation for zero-param tools.

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 ('Check') and the target ('if the current API URL and authentication are valid'), distinguishing it from siblings like 'authenticate' or 'set-api-url' which perform different functions. It precisely communicates the tool's purpose without ambiguity.

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 implies usage context (e.g., verifying API setup or auth status), but does not explicitly state when to use this tool versus alternatives like 'authenticate' or 'keep-session-alive'. It provides clear intent but lacks explicit guidance on exclusions or comparisons with sibling tools.

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

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