Skip to main content
Glama
ethan-hub26

embedcalc-mcp

by ethan-hub26

Register Map → C Generator

embedcalc_regmap_to_c
Read-onlyIdempotent

Generate C shift/mask #defines and a bit-field typedef struct for a hardware register from an LSB-first field list.

Instructions

Generate C shift/mask #defines and a bit-field typedef struct for a hardware register from an LSB-first field list.

Args:

  • register_name (string): e.g. 'CTRL'. Sanitized to [A-Z0-9_].

  • fields (array of {name, width}): fields from bit 0 (LSB) upward, e.g. [{name:'EN',width:1},{name:'MODE',width:2},{name:'DIV',width:5}]. Total width must fit in 32 bits.

Returns (structured): { c_code, total_bits, fields: [{name, width, shift, mask_hex}] }. Text content is the C source (defines + typedef struct with uint32_t bit-fields).

Example: EN:1, MODE:2, DIV:5 -> CTRL_EN_SHIFT 0u / CTRL_EN_MASK 0x1u, CTRL_MODE_MASK 0x6u, CTRL_DIV_MASK 0xF8u. Do not compute shifts/masks by hand — call this tool.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldsYesFields from LSB upward; total width <= 32 bits
register_nameYesRegister name, e.g. 'CTRL'

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
c_codeYes
fieldsYes
total_bitsYes
Behavior4/5

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

Annotations already indicate readOnlyHint=true, idempotentHint=true, destructiveHint=false, so the tool is safe and idempotent. The description adds behavioral details beyond annotations: it explains that register_name is sanitized to [A-Z0-9_], that total width must fit in 32 bits, and that the return value includes structured fields with computed shifts and masks. These additions are valuable and do not contradict annotations.

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 reasonably concise, with a clear structure: one-sentence summary, then Args, Returns, and Example. It is front-loaded with the main purpose. Every sentence adds value. However, the 'Returns' section could be slightly more compact, but overall it is efficient and well-organized.

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

Completeness5/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 (2 required parameters, output schema exists), the description covers all aspects: purpose, parameters with constraints, return structure, an example, and a usage directive. The output schema provides return value details, so the description does not need to repeat them. The description is complete for an AI agent to select and invoke the tool correctly.

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

Parameters5/5

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

Schema description coverage is 100%, but the description adds substantial meaning: it explains what register_name is (e.g., 'CTRL') and its sanitization rule, and it describes the fields array format with an example, clarifying that fields are ordered from LSB upward and that total width must be <= 32 bits. The example further illustrates the mapping. This goes well beyond the schema's basic descriptions.

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

Purpose5/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: 'Generate C shift/mask #defines and a bit-field typedef struct for a hardware register from an LSB-first field list.' It uses a specific verb ('Generate'), identifies the resource ('C shift/mask #defines and a bit-field typedef struct'), and distinguishes from siblings like embedcalc_bitfield_macro and embedcalc_struct_layout by specifying the input format and output structure.

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

Usage Guidelines4/5

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

The description provides clear context: it tells the agent to use this tool when needing to generate C definitions from an LSB-first field list, includes an example, and explicitly says 'Do not compute shifts/masks by hand — call this tool.' However, it does not explicitly state when NOT to use this tool or mention alternatives, though the sibling list implies differentiation. The usage guidance is strong but lacks explicit exclusions.

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/ethan-hub26/embedcalc-mcp'

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