Skip to main content
Glama
hungnguyen1503

Renesas FSP MCP Server

find_code_examples

Find code examples for specific FSP features or peripherals by providing the feature name and optional platform.

Instructions

Find code examples for specific FSP features or peripherals

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
featureNoFeature to find examples for (e.g., 'SPI', 'UART', 'secure_boot')
platformNoTarget platform filter

Implementation Reference

  • The codeExamplesHandler function that executes the tool logic for find_code_examples. It generates formatted text with example categories, direct links, platform compatibility matrix, and usage instructions.
    /**
     * Code Examples Handler
     * Finds and retrieves code examples from FSP repository
     */
    export const codeExamplesHandler = async (args) => {
        const feature = args?.feature || '';
        const platform = args?.platform || '';
        // Common example categories
        const exampleCategories = {
            'SPI': 'SPI Flash Driver Examples',
            'UART': 'UART Communication Examples',
            'I2C': 'I2C Peripheral Examples',
            'ADC': 'ADC Sampling Examples',
            'secure_boot': 'Secure Boot Implementation',
            'RTOS': 'FreeRTOS Integration Examples',
            'middleware': 'Middleware Stack Examples'
        };
        const category = exampleCategories[feature] || `${feature.charAt(0).toUpperCase() + feature.slice(1)} Examples`;
        // Direct links to example files in Renesas FSP repo
        const exampleBase = 'https://github.com/renesas/fsp/tree/master/examples';
        const exampleLinks = feature ? [
            `• Example folder: ${exampleBase}/${feature.toLowerCase()}`,
            `• Documentation: https://renesas.github.io/fsp/group___${feature.toUpperCase().replace(/_/g, '_')}.html`
        ].join('\n') : '';
        return {
            content: [
                {
                    type: "text",
                    text: `
    ================================================================================
    FSP CODE EXAMPLES - ${category}
    ================================================================================
    
    FEATURE: ${feature.toUpperCase()}
    PLATFORM FILTER: ${platform || 'All Platforms'}
    
    --------------------------------------------------------------------------------
    AVAILABLE EXAMPLE CATEGORIES:
    --------------------------------------------------------------------------------
    ${Object.entries(exampleCategories).map(([name, desc]) => `• ${name.padEnd(15)} - ${desc}`).join('\n')}
    
    --------------------------------------------------------------------------------
    ${exampleLinks ? `DIRECT EXAMPLE LINKS FOR "${feature.toUpperCase()}":
    --------------------------------------------------------------------------------
    ${exampleLinks}
    
    --------------------------------------------------------------------------------` : ''}
    RECENT EXAMPLES FOR "${feature}":
    --------------------------------------------------------------------------------
    
    📁 Example 1: Basic ${feature} Implementation
       Location: ${exampleBase}/${feature.toLowerCase()}/basic_${feature.toLowerCase()}.c
       Description: Simple implementation of ${feature} with minimal configuration.
       Lines: ~50 lines
    
    📁 Example 2: Advanced ${feature} with Interrupts
       Location: ${exampleBase}/${feature.toLowerCase()}/interrupt_driven_${feature.toLowerCase()}.c
       Description: Interrupt-driven approach for high-performance ${feature} operations.
       Lines: ~120 lines
    
    📁 Example 3: DMA-based ${feature}
       Location: ${exampleBase}/${feature.toLowerCase()}/dma_${feature.toLowerCase()}.c
       Description: DMA-enabled ${feature} for efficient data transfer.
       Lines: ~80 lines
    
    --------------------------------------------------------------------------------
    PLATFORM-SPECIFIC EXAMPLES:
    --------------------------------------------------------------------------------
    ${platform ?
                        `Current platform filter: ${platform}
       Showing examples optimized for ${platform}...
    ` :
                        `
    📊 PLATFORM COMPATIBILITY MATRIX:
    ┌─────────────┬──────────────┬──────────────┬──────────────┐
    │ Platform    │ SPI          │ UART         │ I2C          │
    ├─────────────┼──────────────┼──────────────┼──────────────┤
    │ RA6M3       │ ✅ Full      │ ✅ Full      │ ✅ Full      │
    │ RA4E1       │ ✅ Full      │ ✅ Full      │ ✅ Full      │
    │ RA8D1       │ ✅ Full      │ ✅ Full      │ ✅ Full      │
    │ RA0E1       │ ✅ Basic     │ ✅ Full      │ ✅ Basic     │
    │ RA2E1       │ ✅ Full      │ ✅ Full      │ ✅ Full      │
    └─────────────┴──────────────┴──────────────┴──────────────┘
    `}
    
    --------------------------------------------------------------------------------
    HOW TO USE EXAMPLES:
    --------------------------------------------------------------------------------
    1. Copy example file to your project directory
    2. Include header: #include "${feature.toLowerCase()}_driver.h"
    3. Initialize driver: FspLib_${feature.toUpperCase()}Init()
    4. Configure parameters using appropriate API calls
    5. Call main function for operation
    
    --------------------------------------------------------------------------------
    FIND MORE EXAMPLES:
    --------------------------------------------------------------------------------
    • GitHub Repository: https://github.com/renesas/fsp/tree/master/examples
    • Documentation: https://renesas.github.io/fsp/examples/
    • Module Examples: https://renesas.github.io/fsp/group___${feature.toUpperCase().replace(/_/g, '_')}.html;
    
    ================================================================================
    `
                }
            ]
        };
    };
  • src/index.ts:71-87 (registration)
    Tool registration for 'find_code_examples' with name, description, and input schema (feature and platform parameters).
    {
      name: "find_code_examples",
      description: "Find code examples for specific FSP features or peripherals",
      inputSchema: {
        type: "object",
        properties: {
          feature: {
            type: "string",
            description: "Feature to find examples for (e.g., 'SPI', 'UART', 'secure_boot')"
          },
          platform: {
            type: "string",
            description: "Target platform filter"
          }
        }
      }
    },
  • src/index.ts:160-160 (registration)
    The handler call for find_code_examples is commented out ('removed per user request') in the CallToolRequestSchema switch statement, meaning the tool is registered but not wired to a handler in the source.
    // case "find_code_examples": removed per user request
  • The exported codeExamplesHandler async function that takes args (feature, platform) and returns a content response with formatted example information.
    export const codeExamplesHandler = async (args) => {
        const feature = args?.feature || '';
        const platform = args?.platform || '';
        // Common example categories
        const exampleCategories = {
            'SPI': 'SPI Flash Driver Examples',
            'UART': 'UART Communication Examples',
            'I2C': 'I2C Peripheral Examples',
            'ADC': 'ADC Sampling Examples',
            'secure_boot': 'Secure Boot Implementation',
            'RTOS': 'FreeRTOS Integration Examples',
            'middleware': 'Middleware Stack Examples'
        };
        const category = exampleCategories[feature] || `${feature.charAt(0).toUpperCase() + feature.slice(1)} Examples`;
        // Direct links to example files in Renesas FSP repo
        const exampleBase = 'https://github.com/renesas/fsp/tree/master/examples';
        const exampleLinks = feature ? [
            `• Example folder: ${exampleBase}/${feature.toLowerCase()}`,
            `• Documentation: https://renesas.github.io/fsp/group___${feature.toUpperCase().replace(/_/g, '_')}.html`
        ].join('\n') : '';
        return {
            content: [
                {
                    type: "text",
                    text: `
    ================================================================================
    FSP CODE EXAMPLES - ${category}
    ================================================================================
    
    FEATURE: ${feature.toUpperCase()}
    PLATFORM FILTER: ${platform || 'All Platforms'}
    
    --------------------------------------------------------------------------------
    AVAILABLE EXAMPLE CATEGORIES:
    --------------------------------------------------------------------------------
    ${Object.entries(exampleCategories).map(([name, desc]) => `• ${name.padEnd(15)} - ${desc}`).join('\n')}
    
    --------------------------------------------------------------------------------
    ${exampleLinks ? `DIRECT EXAMPLE LINKS FOR "${feature.toUpperCase()}":
    --------------------------------------------------------------------------------
    ${exampleLinks}
    
    --------------------------------------------------------------------------------` : ''}
    RECENT EXAMPLES FOR "${feature}":
    --------------------------------------------------------------------------------
    
    📁 Example 1: Basic ${feature} Implementation
       Location: ${exampleBase}/${feature.toLowerCase()}/basic_${feature.toLowerCase()}.c
       Description: Simple implementation of ${feature} with minimal configuration.
       Lines: ~50 lines
    
    📁 Example 2: Advanced ${feature} with Interrupts
       Location: ${exampleBase}/${feature.toLowerCase()}/interrupt_driven_${feature.toLowerCase()}.c
       Description: Interrupt-driven approach for high-performance ${feature} operations.
       Lines: ~120 lines
    
    📁 Example 3: DMA-based ${feature}
       Location: ${exampleBase}/${feature.toLowerCase()}/dma_${feature.toLowerCase()}.c
       Description: DMA-enabled ${feature} for efficient data transfer.
       Lines: ~80 lines
    
    --------------------------------------------------------------------------------
    PLATFORM-SPECIFIC EXAMPLES:
    --------------------------------------------------------------------------------
    ${platform ?
                        `Current platform filter: ${platform}
       Showing examples optimized for ${platform}...
    ` :
                        `
    📊 PLATFORM COMPATIBILITY MATRIX:
    ┌─────────────┬──────────────┬──────────────┬──────────────┐
    │ Platform    │ SPI          │ UART         │ I2C          │
    ├─────────────┼──────────────┼──────────────┼──────────────┤
    │ RA6M3       │ ✅ Full      │ ✅ Full      │ ✅ Full      │
    │ RA4E1       │ ✅ Full      │ ✅ Full      │ ✅ Full      │
    │ RA8D1       │ ✅ Full      │ ✅ Full      │ ✅ Full      │
    │ RA0E1       │ ✅ Basic     │ ✅ Full      │ ✅ Basic     │
    │ RA2E1       │ ✅ Full      │ ✅ Full      │ ✅ Full      │
    └─────────────┴──────────────┴──────────────┴──────────────┘
    `}
    
    --------------------------------------------------------------------------------
    HOW TO USE EXAMPLES:
    --------------------------------------------------------------------------------
    1. Copy example file to your project directory
    2. Include header: #include "${feature.toLowerCase()}_driver.h"
    3. Initialize driver: FspLib_${feature.toUpperCase()}Init()
    4. Configure parameters using appropriate API calls
    5. Call main function for operation
    
    --------------------------------------------------------------------------------
    FIND MORE EXAMPLES:
    --------------------------------------------------------------------------------
    • GitHub Repository: https://github.com/renesas/fsp/tree/master/examples
    • Documentation: https://renesas.github.io/fsp/examples/
    • Module Examples: https://renesas.github.io/fsp/group___${feature.toUpperCase().replace(/_/g, '_')}.html;
    
    ================================================================================
    `
                }
            ]
        };
    };
Behavior2/5

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

No annotations are provided, and the description only states 'find' without details on behavioral traits such as read-only nature, rate limits, or result limitations. The agent lacks understanding of side effects or constraints.

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

Conciseness2/5

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

The description is a single short sentence, but it omits crucial information. It is under-specified rather than efficiently concise, failing to provide sufficient context for an agent.

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?

With no output schema and only two parameters, the description does not explain what the output looks like, how results are formatted, or any pagination. This leaves the agent with incomplete understanding for effective invocation.

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 description coverage is 100%, and the input schema already describes both parameters (feature and platform) adequately. The description does not add additional meaning beyond the schema, so baseline score applies.

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 that the tool finds code examples for FSP features or peripherals, with a specific verb and resource. However, it does not differentiate from sibling tools like search_documentation or get_api_reference, which may overlap in purpose.

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 is provided on when to use this tool versus alternatives. The sibling tools include similar search and reference tools, but the description does not clarify the distinct context for this tool.

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