Skip to main content
Glama

create_plugin_config

Generate custom plugin configurations for APISIX using the MCP server, enabling precise control over plugin settings, descriptions, and labels for API management.

Instructions

Create a new plugin config

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesplugin config ID
pluginsYes

Implementation Reference

  • Registration and inline handler for the 'create_plugin_config' tool. The handler performs a PUT request to the `/plugin_configs` endpoint using the `makeAdminAPIRequest` utility with the input arguments.
    server.tool("create_plugin_config", "Create a new plugin config", CreatePluginConfigSchema.shape, async (args) => {
      return await makeAdminAPIRequest(`/plugin_configs`, "PUT", args);
    });
  • Zod schema defining the input parameters for the create_plugin_config tool: an ID and plugins configuration.
    export const CreatePluginConfigSchema = z.object({
      id: z.string().describe("plugin config ID"),
      plugins: PluginConfigSchema,
    });
  • Helper utility that makes HTTP requests to the APISIX admin API using axios, returning formatted CallToolResult, used by the tool handler.
    export async function makeAdminAPIRequest(
      path: string,
      method: string = "GET",
      data?: object
    ): Promise<CallToolResult> {
      const baseUrl = `${APISIX_SERVER_HOST}:${APISIX_ADMIN_API_PORT}${APISIX_ADMIN_API_PREFIX}`;
      const url = `${baseUrl}${path}`;
    
      try {
        const response = await axios({
          method,
          url,
          data,
          headers: {
            "X-API-KEY": APISIX_ADMIN_KEY,
            "Content-Type": "application/json",
          },
        });
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(response.data, null, 2),
            },
          ],
        };
      } catch (error) {
        if (axios.isAxiosError(error)) {
          console.error(`Request failed: ${method} ${url}`);
          console.error(
            `Status: ${error.response?.status}, Error: ${error.message}`
          );
    
          if (error.response?.data) {
            try {
              const stringifiedData = JSON.stringify(error.response.data);
              console.error(`Response data: ${stringifiedData}`);
            } catch {
              console.error(`Response data: [Cannot parse as JSON]`);
            }
          }
    
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: JSON.stringify(
                  `Status: ${error.response?.status}\nMessage: ${error.message}
    Data:\n${JSON.stringify(error.response?.data || {}, null, 2)}`,
                  null,
                  2
                ),
              },
            ],
          };
        } else {
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: JSON.stringify(error, null, 2),
              },
            ],
          };
        }
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden for behavioral disclosure. 'Create a new plugin config' implies a write operation but doesn't specify permissions required, whether it's idempotent, what happens on conflict (e.g., with existing IDs), or error conditions. For a mutation tool with zero annotation coverage, this is insufficient to guide safe usage.

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 extremely concise at four words, with no wasted language. It's front-loaded with the core action, making it easy to parse quickly. While this brevity contributes to clarity deficits in other dimensions, as a standalone text it's efficiently structured.

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 (2 parameters with nested objects, no output schema, no annotations), the description is inadequate. It doesn't explain what a plugin config is, how it relates to other plugin tools, what the creation entails, or what to expect upon success/failure. For a tool that likely involves system configuration, this leaves critical gaps for an agent to operate effectively.

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?

Schema description coverage is 50%, with 2 parameters documented in the schema (id and plugins). The description adds no information about parameters beyond what's in the schema—it doesn't explain what a plugin config ID is used for, what plugins configuration entails, or how the nested structure works. With low schema coverage, the description fails to compensate for the gaps.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the verb 'create' and resource 'plugin config', which provides a basic understanding of the tool's function. However, it doesn't specify what a plugin config is or how it differs from similar tools like 'create_or_update_plugin_metadata' or 'update_plugin_config' among the siblings. The purpose is clear at a surface level but lacks differentiation from related operations.

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. With siblings like 'create_or_update_plugin_metadata' and 'update_plugin_config', there's no indication of whether this is for initial creation only, what prerequisites might be needed, or when to choose it over other plugin-related tools. This leaves the agent without context for decision-making.

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

Related 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/api7/apisix-mcp'

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