Skip to main content
Glama
r-huijts
by r-huijts

get_config

Retrieve detailed configuration settings including cache, retry policies, and routing strategy by providing a unique configuration identifier.

Instructions

Retrieve detailed information about a specific configuration, including cache settings, retry policies, and routing strategy

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
slugYesThe unique identifier (slug) of the configuration to retrieve. This can be found in the configuration's URL or from the list_configs tool response

Implementation Reference

  • The MCP tool handler function that executes the get_config logic: fetches config via service, extracts and formats key details (cache, retry, strategy, targets), returns structured text response, handles errors.
    async (params) => {
      try {
        const config = await portkeyService.getConfig(params.slug);
        return {
          content: [{ 
            type: "text", 
            text: JSON.stringify({
              success: config.success,
              config: {
                cache: config.data?.config?.cache && {
                  mode: config.data.config.cache.mode,
                  max_age: config.data.config.cache.max_age
                },
                retry: config.data?.config?.retry && {
                  attempts: config.data.config.retry.attempts,
                  on_status_codes: config.data.config.retry.on_status_codes
                },
                strategy: config.data?.config?.strategy && {
                  mode: config.data.config.strategy.mode
                },
                targets: config.data?.config?.targets?.map(target => ({
                  provider: target.provider,
                  virtual_key: target.virtual_key
                }))
              }
            }, null, 2)
          }]
        };
      } catch (error) {
        return {
          content: [{ 
            type: "text", 
            text: `Error fetching configuration details: ${error instanceof Error ? error.message : 'Unknown error'}`
          }]
        };
      }
    }
  • src/index.ts:330-376 (registration)
    Registration of the 'get_config' tool on the MCP server, specifying name, description, input schema, and inline handler.
    server.tool(
      "get_config",
      "Retrieve detailed information about a specific configuration, including cache settings, retry policies, and routing strategy",
      {
        slug: z.string().describe(
          "The unique identifier (slug) of the configuration to retrieve. " +
          "This can be found in the configuration's URL or from the list_configs tool response"
        )
      },
      async (params) => {
        try {
          const config = await portkeyService.getConfig(params.slug);
          return {
            content: [{ 
              type: "text", 
              text: JSON.stringify({
                success: config.success,
                config: {
                  cache: config.data?.config?.cache && {
                    mode: config.data.config.cache.mode,
                    max_age: config.data.config.cache.max_age
                  },
                  retry: config.data?.config?.retry && {
                    attempts: config.data.config.retry.attempts,
                    on_status_codes: config.data.config.retry.on_status_codes
                  },
                  strategy: config.data?.config?.strategy && {
                    mode: config.data.config.strategy.mode
                  },
                  targets: config.data?.config?.targets?.map(target => ({
                    provider: target.provider,
                    virtual_key: target.virtual_key
                  }))
                }
              }, null, 2)
            }]
          };
        } catch (error) {
          return {
            content: [{ 
              type: "text", 
              text: `Error fetching configuration details: ${error instanceof Error ? error.message : 'Unknown error'}`
            }]
          };
        }
      }
    );
  • Input schema for the get_config tool using Zod, requiring a single 'slug' string parameter with description.
    {
      slug: z.string().describe(
        "The unique identifier (slug) of the configuration to retrieve. " +
        "This can be found in the configuration's URL or from the list_configs tool response"
      )
    },
  • Helper method in PortkeyService that performs the actual API call to retrieve configuration details by slug from Portkey.ai.
    async getConfig(slug: string): Promise<GetConfigResponse> {
      try {
        const response = await fetch(`${this.baseUrl}/configs/${slug}`, {
          method: 'GET',
          headers: {
            'x-portkey-api-key': this.apiKey,
            'Accept': 'application/json'
          }
        });
    
        if (!response.ok) {
          throw new Error(`HTTP error! status: ${response.status}`);
        }
    
        const data = await response.json();
        return data;
      } catch (error) {
        console.error('PortkeyService Error:', error);
        throw new Error('Failed to fetch configuration details from Portkey API');
      }
    }
  • TypeScript interface defining the expected response structure from the getConfig API call.
    interface GetConfigResponse {
      success?: boolean;
      data?: {
        config?: ConfigDetails;
      };
    }
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 states this is a retrieval operation, implying read-only behavior, but doesn't disclose critical details like authentication requirements, rate limits, error conditions, or response format. This is inadequate for a tool with no annotation coverage.

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 a single, efficient sentence that front-loads the purpose. It could be slightly more structured by separating usage context, but it's appropriately sized with no wasted words.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what the return value looks like (e.g., JSON structure), error handling, or prerequisites. For a retrieval tool, this leaves significant gaps for the 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%, so the schema fully documents the 'slug' parameter. The description adds no additional parameter information beyond what's in the schema, but the baseline is 3 since the schema does the heavy lifting.

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 action ('Retrieve detailed information') and resource ('specific configuration'), specifying the type of information returned (cache settings, retry policies, routing strategy). It doesn't explicitly distinguish from sibling tools like 'list_configs', which would be needed for a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention the sibling 'list_configs' tool for listing configurations or other get_* tools for different resources, leaving the agent to infer usage context.

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/r-huijts/portkey-admin-mcp-server'

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