Skip to main content
Glama

list_api_keys

Retrieve and view your existing StacksFinder API keys to manage access to tech stack recommendation tools and features.

Instructions

Lists your StacksFinder API keys. Requires a configured API key.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The executeListApiKeys function is the main handler for the 'list_api_keys' tool. It checks for a configured API key, fetches the list of API keys from the StacksFinder API, formats them into a markdown table with usage stats, and handles errors like invalid keys or network issues.
    export async function executeListApiKeys(): Promise<{ text: string; isError?: boolean }> { const config = getConfig(); if (!config.apiKey) { return { text: `**Error**: No API key configured. Use \`setup_api_key\` tool first or set STACKSFINDER_API_KEY environment variable.`, isError: true }; } debug('Listing API keys'); try { const response = await fetch(`${config.apiUrl}/api/v1/keys`, { method: 'GET', headers: { Authorization: `Bearer ${config.apiKey}`, 'Content-Type': 'application/json' } }); if (!response.ok) { if (response.status === 401) { return { text: '**Error**: Invalid API key. Please reconfigure with a valid key.', isError: true }; } const errorText = await response.text(); return { text: `**Error**: Failed to list keys (${response.status}): ${errorText}`, isError: true }; } const data = (await response.json()) as ListKeysResponse; let text = `## Your API Keys **Usage**: ${data.limits.used}/${data.limits.max} keys (${data.limits.remaining} remaining) | Name | Prefix | Scopes | Created | Last Used | |------|--------|--------|---------|-----------| `; for (const key of data.keys) { const lastUsed = key.lastUsedAt ? new Date(key.lastUsedAt).toLocaleDateString() : 'Never'; const created = new Date(key.createdAt).toLocaleDateString(); const scopes = key.scopes.join(', '); text += `| ${key.name} | ${key.prefix}...${key.suffix} | ${scopes} | ${created} | ${lastUsed} |\n`; } if (data.keys.length === 0) { text += `| (no keys) | - | - | - | - |\n`; } text += `\nManage keys at: ${config.apiUrl}/account/developer/api-keys`; return { text }; } catch (err) { const errorMessage = err instanceof Error ? err.message : 'Failed to list API keys'; return { text: `**Error**: ${errorMessage}`, isError: true }; }
  • The ListApiKeysInputSchema defines the input schema for the tool, which takes no parameters (empty object).
    * Input schema for list_api_keys tool. */ export const ListApiKeysInputSchema = z.object({}); export type ListApiKeysInput = z.infer<typeof ListApiKeysInputSchema>;
  • src/server.ts:291-306 (registration)
    Registers the 'list_api_keys' tool with the MCP server using server.registerTool, referencing the tool definition and handler function executeListApiKeys.
    server.registerTool( listApiKeysToolDefinition.name, { title: 'List API Keys', description: listApiKeysToolDefinition.description, inputSchema: {} }, async () => { debug('list_api_keys called'); const { text, isError } = await executeListApiKeys(); return { content: [{ type: 'text', text }], isError }; } );
  • The listApiKeysToolDefinition provides the name and description used for tool registration.
    /** * Tool definition for list_api_keys. */ export const listApiKeysToolDefinition = { name: 'list_api_keys', description: 'Lists your StacksFinder API keys. Requires a configured API key.' };

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/hoklims/stacksfinder-mcp'

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