Skip to main content
Glama
nahmanmate

Code Research MCP Server

by nahmanmate

search_mdn

Find web development documentation on MDN Web Docs by entering search queries to access technical references and guides.

Instructions

Search MDN Web Docs for web development documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query

Implementation Reference

  • Core handler function for search_mdn tool. Queries MDN search API with the given query, caches results using NodeCache for 1 hour, formats and returns top 5 results as a string.
    private async searchMDN(query: string): Promise<string> {
      const cacheKey = `mdn:${query}`;
      const cached = cache.get<string>(cacheKey);
      if (cached) return cached;
    
      try {
        const response = await this.axiosInstance.get(
          'https://developer.mozilla.org/api/v1/search',
          {
            params: {
              q: query,
              locale: 'en-US'
            }
          }
        );
    
        const results = response.data.documents.slice(0, 5).map((doc: any, i: number) => 
          `${i + 1}. ${doc.title}\n   ${doc.summary}\n   https://developer.mozilla.org${doc.mdn_url}\n`
        ).join('\n');
    
        cache.set(cacheKey, results);
        return results;
      } catch (error) {
        throw new McpError(
          ErrorCode.InternalError,
          `MDN API error: ${error instanceof Error ? error.message : 'Unknown error'}`
        );
      }
    }
  • src/index.ts:340-353 (registration)
    Tool registration in listTools handler, including name 'search_mdn', description, and input schema requiring a 'query' string.
    {
      name: 'search_mdn',
      description: 'Search MDN Web Docs for web development documentation',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'Search query'
          }
        },
        required: ['query']
      }
    },
  • Dispatch handler in CallToolRequestSchema that extracts the query argument and invokes the searchMDN function, returning the result as MCP text content.
    case 'search_mdn': {
      const { query } = request.params.arguments as { query: string };
      const results = await this.searchMDN(query);
      return {
        content: [
          {
            type: 'text',
            text: results
          }
        ]
      };
  • Input schema definition for search_mdn tool, specifying an object with required 'query' string property.
    inputSchema: {
      type: 'object',
      properties: {
        query: {
          type: 'string',
          description: 'Search query'
        }
      },
      required: ['query']
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool searches MDN Web Docs but doesn't describe what the search returns (e.g., articles, code snippets), how results are formatted, any rate limits, authentication needs, or error handling. This leaves significant gaps in understanding the tool's behavior.

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 a single, clear sentence that efficiently communicates the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to understand at a glance.

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

Completeness2/5

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

For a search tool with no annotations and no output schema, the description is incomplete. It doesn't explain what kind of results to expect (e.g., links, summaries), how many results are returned, or any behavioral nuances. This leaves the agent with insufficient context to use the tool effectively.

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 input schema has 100% description coverage, with the single parameter 'query' documented as 'Search query'. The description doesn't add any additional meaning beyond this, such as query syntax examples or search scope details. Given the high schema coverage, the baseline score of 3 is appropriate.

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 action ('Search') and target resource ('MDN Web Docs for web development documentation'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this tool from its sibling tools (search_all, search_github, etc.) beyond specifying the MDN source, which prevents a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus its sibling alternatives. There's no mention of specific use cases for MDN documentation over other sources like GitHub or Stack Overflow, nor any prerequisites or exclusions for usage.

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/nahmanmate/code-research-mcp-server'

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