Skip to main content
Glama
cunjun
by cunjun

rtos_task_context

Reads blocked or suspended FreeRTOS task registers, reconstructing R0-R12, SP, LR, PC, xPSR and resolving PC to a source line. Returns live registers if task is running.

Instructions

Read the saved register context of a blocked or suspended FreeRTOS task.

Parses the Cortex-M4F context switch stack frame stored in the task's TCB. Reconstructs R0-R12, SP, LR, PC, xPSR and resolves PC to a symbol/source line. Automatically detects whether FPU context was saved (EXC_RETURN bit 4). If the named task is currently running, returns live register values instead.

task_name: exact task name as passed to xTaskCreate (case-sensitive). task_name_len: configMAX_TASK_NAME_LEN in your FreeRTOS build (default 16). Requires ELF loaded and probe connected with target halted.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_nameYes
task_name_lenNo
Behavior5/5

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

With no annotations, the description carries full burden and excels: it discloses the internal mechanism (parsing TCB stack frame), the FPU detection via EXC_RETURN bit 4, the conditional handling of running tasks, and prerequisites (ELF, probe, halted target). This provides deep insight into tool 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 well-structured and every sentence contributes: purpose, mechanism, register list, FPU detection, running-task behavior, prerequisites, and parameter details. It is front-loaded with the main action and avoids fluff.

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 an RTOS task context reader with no output schema, the description covers prerequisites, behavior, conditional cases, and parameter semantics. It names the reconstructed registers and PC resolution, giving a solid mental model of the return value without needing an explicit output schema.

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 0%, but the description fully compensates by defining task_name as the exact case-sensitive name passed to xTaskCreate and task_name_len as configMAX_TASK_NAME_LEN with a default of 16. This adds meaning beyond the bare schema titles.

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 uses a specific verb ('Read') and identifies the resource precisely: the saved register context of a blocked or suspended FreeRTOS task. It enumerates the reconstructed registers and PC resolution, making it clearly distinct from siblings like read_stopped_context (current halted context) and backtrace (stack trace).

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

Usage Guidelines3/5

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

The description gives clear context (for FreeRTOS tasks, requires ELF loaded and target halted) but does not explicitly name alternatives or state when not to use this tool. The condition about running tasks is a behavior, not a usage exclusion, so guidance is implied rather than explicit.

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/cunjun/McuBuddy'

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