Skip to main content
Glama

List API Keys

list_api_keys
Read-only

View and manage your StacksFinder API keys to access tech stack recommendation tools and pro features.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The executeListApiKeys function implements the core logic of the list_api_keys tool. It checks for a configured API key, fetches the user's API keys from the StacksFinder API (/api/v1/keys), handles authentication errors and other failures, parses the response, and formats it as a Markdown table showing key details including name, prefix/suffix, scopes, creation date, last used date, and usage limits.
    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
    		};
    	}
    }
  • src/server.ts:331-351 (registration)
    Registers the list_api_keys tool with the MCP server using listApiKeysToolDefinition.name, sets title, description from the definition, empty inputSchema, read-only annotations, and a handler that calls executeListApiKeys() and returns the text content with isError flag.
    server.registerTool(
    	listApiKeysToolDefinition.name,
    	{
    		title: 'List API Keys',
    		description: listApiKeysToolDefinition.description,
    		inputSchema: {},
    		annotations: {
    			readOnlyHint: true,
    			destructiveHint: false,
    			openWorldHint: false
    		}
    	},
    	async () => {
    		debug('list_api_keys called');
    		const { text, isError } = await executeListApiKeys();
    		return {
    			content: [{ type: 'text', text }],
    			isError
    		};
    	}
    );
  • Defines the input schema as an empty object (no parameters required) and the tool metadata including name 'list_api_keys' and description. Also exports the inferred TypeScript type.
    export const ListApiKeysInputSchema = z.object({});
    
    export type ListApiKeysInput = z.infer<typeof ListApiKeysInputSchema>;
    
    /**
     * Tool definition for list_api_keys.
     */
    export const listApiKeysToolDefinition = {
    	name: 'list_api_keys',
    	description: 'Lists your StacksFinder API keys. Requires a configured API key.'
    };
Behavior4/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, and openWorldHint=false, covering safety and scope. The description adds valuable context by specifying the prerequisite ('Requires a configured API key'), which is not captured in annotations, enhancing transparency about authentication needs.

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 two sentences, front-loaded with the core purpose followed by a prerequisite. Every word earns its place, with no redundancy or unnecessary elaboration, making it highly efficient and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, no output schema) and rich annotations, the description is mostly complete. It covers purpose and prerequisites, but lacks details on return values (e.g., format of listed keys) and behavioral aspects like pagination or rate limits, which could be useful despite the annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0 parameters and 100% schema description coverage, the baseline is 4 as there are no parameters to document. The description does not need to add parameter details, and it appropriately focuses on the tool's purpose and prerequisites instead.

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

Purpose5/5

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

The description clearly states the specific action ('Lists') and resource ('your StacksFinder API keys'), distinguishing it from siblings like 'revoke_api_key' (destructive) and 'setup_api_key' (creation). It precisely defines the tool's scope without ambiguity.

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

Usage Guidelines4/5

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

The description provides clear context by stating 'Requires a configured API key,' indicating a prerequisite for use. However, it does not explicitly mention when to use this tool versus alternatives like 'setup_api_key' or 'revoke_api_key,' nor does it specify exclusions, leaving some guidance implicit.

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

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