Skip to main content
Glama
hungnguyen1503

Renesas FSP MCP Server

get_api_reference

Retrieve API reference documentation for Renesas FSP functions and structures by specifying module and function name.

Instructions

Get API reference documentation for FSP functions and structures

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
moduleNoModule name (e.g., 'FspLib', 'Spi', 'I2c')
functionNoSpecific function name

Implementation Reference

  • The apiReferenceHandler async function that implements the 'get_api_reference' tool logic. It loads module data from a JSON file, checks if the requested module is known, and returns static API reference documentation for FSP modules (currently supports 'FspLib' and 'r_sci_b_uart').
    /**
     * API Reference Handler
     * Provides API documentation for FSP functions and structures
     */
    
    import * as fs from 'fs';
    import * as path from 'path';
    
    // Load module list
    const modulesPath = path.join(process.cwd(), 'src', 'fsp-modules.json');
    let moduleList: any = { modules: [], api_base_url: '', src_base_url: '', instances_base_url: '' };
    try {
      const data = fs.readFileSync(modulesPath, 'utf8');
      moduleList = JSON.parse(data);
    } catch (e) {
      // ignore
    }
    
    export const apiReferenceHandler = async (args?: any) => {
      const module = args?.module || 'FspLib';
      const function_name = args?.function || '';
    
      const isKnown = (moduleList.modules as string[]).map(m => m.toLowerCase()).includes(module.toLowerCase());
      const apiUrl = `${moduleList.api_base_url}/${module.toLowerCase()}.h`;
      const srcUrl = `${moduleList.src_base_url}/${module.toLowerCase()}`;
      const instancesUrl = `${moduleList.instances_base_url}/${module.toLowerCase()}.h`;
    
      if (!isKnown && module !== 'FspLib') {
        return {
          content: [
            {
              type: "text",
              text: `
    ================================================================================
    FSP API REFERENCE - ${module.toUpperCase()}
    ================================================================================
    
    Module "${module}" is not recognized in the current FSP API reference dataset.
    
    Known modules: ${moduleList.modules.join(', ')}
    
    Please check the official Renesas FSP resources:
    • API header: ${apiUrl}
    • Source code: ${srcUrl}
    • Instance header: ${instancesUrl}
    • Documentation: https://renesas.github.io/fsp/modules.html;
    
    ================================================================================
    `
            }
          ]
        };
      }
    
      // For known modules, provide static info (could be expanded to fetch from repo)
      const staticModules: Record<string, any> = {
        'FspLib': {
          description: 'Core FSP Library - Main initialization and control functions',
          functions: [
            { name: 'FspLib_Init', return_type: 'void', parameters: [{ name: 'config_ptr', type: 'const fsp_config_t*', description: 'Pointer to configuration structure' }], description: 'Initialize FSP services and hardware components' },
            { name: 'FspLib_Exit', return_type: 'void', parameters: [{ name: 'status', type: 'uint32_t', description: 'Exit status code' }], description: 'Exit FSP and transfer control to bootloader or application' },
            { name: 'FspLib_GetVersion', return_type: 'const char*', parameters: [], description: 'Get current FSP version string' }
          ]
        },
        'r_sci_b_uart': {
          description: 'SCI UART Driver - UART communication via SCI peripheral',
          functions: [
            { name: 'R_SCI_B_UART_Open', return_type: 'fsp_err_t', parameters: [{ name: 'p_api_ctrl', type: 'sci_b_uart_ctrl_t *', description: 'Control structure' }, { name: 'p_cfg', type: 'sci_b_uart_cfg_t const *', description: 'Configuration' }], description: 'Open UART channel' },
            { name: 'R_SCI_B_UART_Write', return_type: 'fsp_err_t', parameters: [{ name: 'p_api_ctrl', type: 'sci_b_uart_ctrl_t *' }, { name: 'p_src', type: 'uint8_t const *' }, { name: 'bytes', type: 'uint32_t' }], description: 'Write data to UART' }
          ]
        }
      };
    
      const module_info = staticModules[module] || staticModules['FspLib'];
    
      return {
        content: [
          {
            type: "text",
            text: `
    ================================================================================
    FSP API REFERENCE - ${module.toUpperCase()}
    ================================================================================
    
    MODULE: ${module.toUpperCase()}
    DESCRIPTION: ${module_info.description}
    
    --------------------------------------------------------------------------------
    FUNCTIONS (examples):
    --------------------------------------------------------------------------------
    ${module_info.functions.map((f: any) => 
      `
    📄 ${f.name}()
       Return Type: ${f.return_type}
       Description: ${f.description}
       Parameters:
       ` + f.parameters.map((p: any) => `     • ${p.type} ${p.name} - ${p.description}`).join('\n')
    ).join('')}
    
    --------------------------------------------------------------------------------
    OFFICIAL RENESAS FSP RESOURCES:
    --------------------------------------------------------------------------------
    • API header: ${apiUrl}
    • Source code: ${srcUrl}
    • Instance header: ${instancesUrl}
    • Documentation: https://renesas.github.io/fsp/group___${module.toUpperCase()}.html
    
    ================================================================================
    `
          }
        ]
      };
    };
  • src/index.ts:14-14 (registration)
    Import of apiReferenceHandler from the api-reference handler module.
    import { apiReferenceHandler } from "./handlers/api-reference.js";
  • Input schema definition for the 'get_api_reference' tool, defining 'module' and 'function' as string input properties.
      name: "get_api_reference",
      description: "Get API reference documentation for FSP functions and structures",
      inputSchema: {
        type: "object",
        properties: {
          module: {
            type: "string",
            description: "Module name (e.g., 'FspLib', 'Spi', 'I2c')"
          },
          function: {
            type: "string",
            description: "Specific function name"
          }
        }
      }
    },
  • src/index.ts:161-162 (registration)
    The case statement in the CallToolRequestSchema handler that routes 'get_api_reference' calls to apiReferenceHandler(args).
    case "get_api_reference":
      return await apiReferenceHandler(args);
Behavior2/5

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

No annotations provided. Description fails to disclose return format (e.g., markdown, HTML) or any other behavioral traits beyond 'Get'.

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?

Single sentence, front-loaded verb, no superfluous words. Efficient for its length.

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?

Adequate for a simple retrieval tool with full parameter coverage, but lacks behavioral disclosure and usage context that would elevate completeness.

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?

Schema coverage is 100% and parameter descriptions are clear. Description adds minimal value beyond 'for FSP functions and structures'.

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?

Description clearly states 'Get API reference documentation' - a specific verb+resource. It distinguishes from sibling 'search_documentation' by implying reference vs. search, but could be more explicit.

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?

No guidance on when to use this tool vs. siblings like 'search_documentation' or 'find_code_examples'. No context for prerequisites or post-conditions.

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/hungnguyen1503/fsp-mcp'

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