Skip to main content
Glama

get_documentation

Retrieve detailed Apple developer documentation for specific symbols like View, Button, or GridItem to access API references and framework details directly.

Instructions

Get detailed documentation for specific symbols within the selected technology. Use this for known symbol names (e.g., "View", "Button", "GridItem"). Accepts relative symbol names.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesSymbol path or relative name (e.g. "View", "GridItem", "Button")

Implementation Reference

  • The exported buildGetDocumentationHandler function creates and returns the core handler logic for the 'get_documentation' tool. It handles fetching symbol data, error fallback for path prefixing, formatting into markdown sections, and returning the response.
    export const buildGetDocumentationHandler = (context: ServerContext) => {
    	const {client, state} = context;
    	const noTechnology = buildNoTechnologyMessage(context);
    
    	return async ({path}: {path: string}): Promise<ToolResponse> => {
    		const activeTechnology = state.getActiveTechnology();
    		if (!activeTechnology) {
    			return noTechnology();
    		}
    
    		const framework = await loadActiveFrameworkData(context);
    		const identifierParts = activeTechnology.identifier.split('/');
    		const frameworkName = identifierParts.at(-1);
    
    		// Try path as-is first, fallback to framework-prefixed path
    		let targetPath = path;
    		let data: SymbolData;
    
    		try {
    			// First attempt: try the path exactly as provided
    			data = await client.getSymbol(targetPath);
    		} catch (error) {
    			// If that fails and path doesn't already start with documentation/,
    			// try prefixing with framework path
    			if (path.startsWith('documentation/')) {
    				// Path already starts with documentation/, so just rethrow original error
    				throw error;
    			} else {
    				try {
    					targetPath = `documentation/${frameworkName}/${path}`;
    					data = await client.getSymbol(targetPath);
    				} catch {
    					// If both attempts fail, throw the original error with helpful context
    					throw new McpError(
    						ErrorCode.InvalidRequest,
    						`Failed to load documentation for both "${path}" and "${targetPath}": ${error instanceof Error ? error.message : String(error)}`,
    					);
    				}
    			}
    		}
    
    		const title = data.metadata?.title || 'Symbol';
    		const kind = data.metadata?.symbolKind || 'Unknown';
    		const platforms = client.formatPlatforms(data.metadata?.platforms ?? framework.metadata.platforms);
    		const description = client.extractText(data.abstract);
    
    		const content: string[] = [
    			header(1, title),
    			'',
    			bold('Technology', activeTechnology.title),
    			bold('Type', kind),
    			bold('Platforms', platforms),
    			'',
    			header(2, 'Overview'),
    			description,
    		];
    
    		content.push(...formatTopicSections(data, client));
    
    		return {
    			content: [{text: content.join('\n'), type: 'text'}],
    		};
    	};
    };
  • The tool definition in the toolDefinitions array, registering the 'get_documentation' tool with its name, description, input schema, and handler reference to the builder function.
    {
    	name: 'get_documentation',
    	description: 'Get detailed documentation for specific symbols within the selected technology. '
    		+ 'Use this for known symbol names (e.g., "View", "Button", "GridItem"). Accepts relative symbol names.',
    	inputSchema: {
    		type: 'object',
    		required: ['path'],
    		properties: {
    			path: {
    				type: 'string',
    				description: 'Symbol path or relative name (e.g. "View", "GridItem", "Button")',
    			},
    		},
    	},
    	handler: buildGetDocumentationHandler(context),
    },
  • The inputSchema defining the parameters for the get_documentation tool: an object requiring a 'path' string.
    inputSchema: {
    	type: 'object',
    	required: ['path'],
    	properties: {
    		path: {
    			type: 'string',
    			description: 'Symbol path or relative name (e.g. "View", "GridItem", "Button")',
    		},
    	},
    },
  • Helper function to format topic sections into markdown lists using identifiers and references.
    const formatTopicSections = (data: SymbolData, client: ServerContext['client']): string[] => {
    	const content: string[] = [];
    
    	if (data.topicSections?.length) {
    		content.push('', header(2, 'API Reference'), '');
    		for (const section of data.topicSections) {
    			content.push(`### ${section.title}`);
    			if (section.identifiers?.length) {
    				content.push(...formatIdentifiers(section.identifiers, data.references, client));
    			}
    
    			content.push('');
    		}
    	}
    
    	return content;
    };
  • Helper function to format a list of identifiers into bulleted markdown items with descriptions, limited to 5 with ellipsis.
    const formatIdentifiers = (identifiers: string[], references: Record<string, ReferenceData> | undefined, client: ServerContext['client']): string[] => {
    	const content: string[] = [];
    
    	for (const id of identifiers.slice(0, 5)) {
    		const ref = references?.[id];
    		if (ref) {
    			const refDesc = client.extractText(ref.abstract ?? []);
    			content.push(`• **${ref.title}** - ${trimWithEllipsis(refDesc, 100)}`);
    		}
    	}
    
    	if (identifiers.length > 5) {
    		content.push(`*... and ${identifiers.length - 5} more items*`);
    	}
    
    	return content;
    };
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'detailed documentation' but doesn't specify what that includes (e.g., format, length, examples) or any constraints like rate limits, authentication needs, or error handling. The phrase 'within the selected technology' hints at a prerequisite but doesn't clarify how technology selection works (e.g., via 'choose_technology' sibling). This leaves significant gaps for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with two sentences that efficiently cover purpose and usage. It's front-loaded with the core function and includes helpful examples. There's no wasted text, though it could be slightly more structured by separating prerequisites or constraints into distinct points.

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

Completeness3/5

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

Given the tool's moderate complexity (single parameter, no output schema, no annotations), the description is adequate but incomplete. It covers the basic purpose and parameter usage but lacks details on behavioral aspects like output format, error cases, or dependencies on other tools (e.g., technology selection). Without annotations or output schema, more context would be beneficial for effective agent use.

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

Parameters3/5

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

The schema description coverage is 100%, with the parameter 'path' fully documented in the schema as 'Symbol path or relative name'. The description adds minimal value beyond this, only repeating 'Accepts relative symbol names' and providing examples like '"View"'. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't significantly enhance parameter understanding.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Get detailed documentation for specific symbols within the selected technology.' It specifies the verb ('Get'), resource ('documentation'), and scope ('specific symbols within the selected technology'). However, it doesn't explicitly differentiate from sibling tools like 'search_symbols' or 'discover_technologies' beyond mentioning 'known symbol names'.

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

Usage Guidelines3/5

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

The description provides some guidance with 'Use this for known symbol names (e.g., "View", "Button", "GridItem")', which implies this tool is for lookup rather than discovery. However, it doesn't explicitly state when not to use it or name alternatives like 'search_symbols' for unknown symbols, leaving usage context somewhat implied rather than fully explicit.

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/MightyDillah/apple-doc-mcp'

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