Skip to main content
Glama
ethan-hub26

embedcalc-mcp

by ethan-hub26

C Struct Memory Layout Calculator

embedcalc_struct_layout
Read-onlyIdempotent

Compute the memory layout of a C struct/union for a 32-bit ARM Cortex-M MCU: member offsets, padding, bit-field packing, total size, and alignment.

Instructions

Compute the memory layout of a C struct/union — member offsets, inserted padding, bit-field packing, total size, and alignment — for a 32-bit MCU model (ARM Cortex-M style: pointers 4 bytes; double/int64 size 8 with 4-byte alignment, matching embedcalc.com).

Args: code (string) — C member declarations or a full struct, e.g. 'char a; int b;' or 'struct s { uint8_t a; uint32_t b; };'. Supports nested struct/union, arrays, pointers, and bit-fields.

Returns (structured): { total_size, alignment, padding_bytes, rows: [{offset, size, type, name, kind, depth}] }. Nested block rows show offsets relative to their parent block. Example: 'char a; int b;' -> total 8 bytes, 3 bytes padding after 'a'. Do not guess struct sizes/offsets — padding rules are exactly what LLMs get wrong.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesC struct member declarations (or full struct/union definition)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
rowsYes
alignmentYes
total_sizeYes
padding_bytesYes
Behavior5/5

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

Beyond annotations (readOnlyHint, destructiveHint, idempotentHint), the description explains the computational behavior: it applies 32-bit MCU model rules, returns structured output with offsets, padding, and nesting relative offsets. No contradictions.

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 appropriately sized: two paragraphs front-loading the core purpose and behavior, followed by clear arg/return details. Every sentence adds value.

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 complexity of the tool, the description covers input format, supported features, output structure, and a usage warning. The output schema exists, which is not strictly needed but complements the description.

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?

The single parameter 'code' has 100% schema coverage, but the description adds meaning by specifying acceptable formats (member declarations or full struct), providing examples, and listing supported constructs (nested, arrays, pointers, bit-fields).

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 it computes memory layout of C struct/union, including member offsets, padding, bit-field packing, total size, and alignment. It specifies the target model (ARM Cortex-M style), distinguishing it from all sibling tools which are other calculator types.

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 context on when to use (when accurate memory layout is needed) and includes a warning against guessing sizes. It does not explicitly list alternatives, but no sibling tool serves the same purpose, so exclusion is unnecessary.

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