get-backend-metadata
Retrieve structured metadata from the Insforge backend platform to access Auth, Database, Storage, and Functions configuration details for development workflows.
Instructions
Index all backend metadata
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apiKey | No | API key for authentication (optional if provided via --api_key) |
Implementation Reference
- src/shared/tools.ts:415-447 (handler)The core handler function for the 'get-backend-metadata' tool. It fetches metadata from the backend API endpoint `/api/metadata?mcp=true` using the resolved API key, processes the response, adds optional background context, and returns a formatted text content block or error response.withUsageTracking('get-backend-metadata', async ({ apiKey }) => { try { const actualApiKey = getApiKey(apiKey); const response = await fetch(`${API_BASE_URL}/api/metadata?mcp=true`, { method: 'GET', headers: { 'x-api-key': actualApiKey, }, }); const metadata = await handleApiResponse(response); return await addBackgroundContext({ content: [ { type: 'text', text: `Backend metadata:\n\n${JSON.stringify(metadata, null, 2)}`, }, ], }); } catch (error) { const errMsg = error instanceof Error ? error.message : 'Unknown error occurred'; return { content: [ { type: 'text', text: `Error retrieving backend metadata: ${errMsg}`, }, ], isError: true, }; } })
- src/shared/tools.ts:406-448 (registration)The MCP server.tool registration for 'get-backend-metadata', including tool name, description, input schema, and wrapped handler reference.server.tool( 'get-backend-metadata', 'Index all backend metadata', { apiKey: z .string() .optional() .describe('API key for authentication (optional if provided via --api_key)'), }, withUsageTracking('get-backend-metadata', async ({ apiKey }) => { try { const actualApiKey = getApiKey(apiKey); const response = await fetch(`${API_BASE_URL}/api/metadata?mcp=true`, { method: 'GET', headers: { 'x-api-key': actualApiKey, }, }); const metadata = await handleApiResponse(response); return await addBackgroundContext({ content: [ { type: 'text', text: `Backend metadata:\n\n${JSON.stringify(metadata, null, 2)}`, }, ], }); } catch (error) { const errMsg = error instanceof Error ? error.message : 'Unknown error occurred'; return { content: [ { type: 'text', text: `Error retrieving backend metadata: ${errMsg}`, }, ], isError: true, }; } }) );
- src/shared/tools.ts:409-414 (schema)Zod input schema for the tool, defining an optional 'apiKey' parameter.{ apiKey: z .string() .optional() .describe('API key for authentication (optional if provided via --api_key)'), },
- src/shared/tools.ts:192-198 (helper)Helper function used by the handler to resolve the API key from global config, ignoring tool-specific param for consistency.// The optional parameter is kept for backward compatibility but ignored const getApiKey = (_toolApiKey?: string): string => { if (!GLOBAL_API_KEY) { throw new Error('API key is required. Pass --api_key when starting the MCP server.'); } return GLOBAL_API_KEY; };