get_all_plugin_names
Retrieve a list of all available plugin names from APISIX-MCP, enabling integration and management of plugins for enhanced API gateway functionality.
Instructions
Get all plugin names
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/plugin.ts:13-15 (handler)The handler function for the 'get_all_plugin_names' MCP tool. It executes by making an HTTP GET request to the APISIX admin API endpoint `/plugins/list` via the makeAdminAPIRequest helper.server.tool("get_all_plugin_names", "Get all plugin names", async () => { return await makeAdminAPIRequest(`/plugins/list`); });
- src/utils/adminAPI.ts:11-80 (helper)Helper utility function that performs authenticated HTTP requests to the APISIX admin API and formats the response as MCP CallToolResult. Used by the get_all_plugin_names handler and other tools.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), }, ], }; } } }
- src/tools/plugin.ts:13-15 (registration)Registers the 'get_all_plugin_names' tool with the MCP server using server.tool(), providing name, description, and handler function.server.tool("get_all_plugin_names", "Get all plugin names", async () => { return await makeAdminAPIRequest(`/plugins/list`); });