get_api_reference
Retrieve comprehensive API documentation for Ember.js classes, modules, or methods, including parameters, return values, examples, and official links.
Instructions
Get detailed API reference documentation for a specific Ember class, module, or method. Returns full API documentation including parameters, return values, examples, and links to official API docs.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the API element (e.g., 'Component', '@glimmer/component', 'Service', 'Router') | |
| type | No | Type of API element (optional) |
Implementation Reference
- index.js:79-99 (registration)Registration of the 'get_api_reference' tool in the MCP server's tool list, including name, description, and input schema.{ name: "get_api_reference", description: "Get detailed API reference documentation for a specific Ember class, module, or method. Returns full API documentation including parameters, return values, examples, and links to official API docs.", inputSchema: { type: "object", properties: { name: { type: "string", description: "Name of the API element (e.g., 'Component', '@glimmer/component', 'Service', 'Router')", }, type: { type: "string", enum: ["class", "module", "method", "property"], description: "Type of API element (optional)", }, }, required: ["name"], }, },
- index.js:240-264 (handler)The main handler function for the 'get_api_reference' tool. Extracts arguments, calls DocumentationService.getApiReference, formats the result, and returns the MCP response.async handleGetApiReference(args) { const { name, type } = args; const apiDoc = await this.docService.getApiReference(name, type); if (!apiDoc) { return { content: [ { type: "text", text: `No API documentation found for "${name}". Try searching with search_ember_docs first.`, }, ], }; } const formattedDoc = formatApiReference(apiDoc, this.docService.deprecationManager); return { content: [ { type: "text", text: formattedDoc, }, ], }; }
- index.js:83-98 (schema)Input schema defining the parameters for the 'get_api_reference' tool: name (required string), type (optional enum).inputSchema: { type: "object", properties: { name: { type: "string", description: "Name of the API element (e.g., 'Component', '@glimmer/component', 'Service', 'Router')", }, type: { type: "string", enum: ["class", "module", "method", "property"], description: "Type of API element (optional)", }, }, required: ["name"], },
- lib/documentation-service.js:510-559 (handler)Core implementation of API reference lookup in DocumentationService: retrieves from indexed API data or searches and parses JSON from documentation sections.async getApiReference(name, type) { const key = name.toLowerCase(); const apiDoc = this.apiIndex.get(key); if (!apiDoc) { // Try to search for it const results = await this.search(name, "api", 1); if (results.length > 0 && results[0].apiLink) { // Try to extract from the content const apiDocs = this.sections["api-docs"] || []; for (const doc of apiDocs) { if (doc.content.toLowerCase().includes(key)) { try { const jsonMatch = doc.content.match(/\{[\s\S]*"data"[\s\S]*\}/); if (jsonMatch) { const parsed = JSON.parse(jsonMatch[0]); if (parsed.data?.attributes) { const attrs = parsed.data.attributes; return { name: attrs.name || attrs.shortname, type: parsed.data.type, module: attrs.module, description: attrs.description, file: attrs.file, line: attrs.line, extends: attrs.extends, methods: attrs.methods || [], properties: attrs.properties || [], apiUrl: results[0].apiLink, }; } } } catch (e) { // Continue searching } } } } return null; } // Check if API is deprecated const deprecationInfo = this.deprecationManager.getDeprecationInfo(apiDoc.name); return { ...apiDoc, apiUrl: generateApiUrl(apiDoc.name, apiDoc.type), deprecationInfo: deprecationInfo, }; }