Skip to content

[plan] Populate structured output in MCP tool handlers (start with status and compile tools) #30119

@github-actions

Description

@github-actions

Objective

Populate the second (structured) return value in MCP tool handlers so AI clients can parse structuredContent directly instead of re-parsing embedded JSON text.

Context

From discussion #30108 (Go Fan module review): all 10 tool handlers currently return nil as the structured output:

return result, nil, nil
//            ^^^ always nil

The SDK's AddTool[In, Out] generic pattern is designed so that when Out is a typed struct, the SDK automatically populates structuredContent. AI clients parse this more reliably than raw JSON text.

Approach

  1. Define typed output structs for the status and compile tools (e.g., StatusOutput, CompileOutput)
  2. Change the tool registration to use these output types: mcp.AddTool[StatusInput, StatusOutput](...)
  3. Return the populated struct instead of nil as the second return value
  4. Verify the JSON text content remains unchanged for backward compatibility

Files to Modify

  • pkg/cli/mcp_server.go — update tool registrations and handler return values
  • pkg/cli/mcp_server_test.go (or integration tests) — validate structured content is populated

Acceptance Criteria

  • status tool returns a populated typed struct as structured output
  • compile tool returns a populated typed struct as structured output
  • Existing text content is unchanged (backward compatible)
  • Tests verify structuredContent is non-nil
  • make test-unit passes

Generated by Plan Command for issue #discussion #30108 · ● 308.5K ·

  • expires on May 6, 2026, 9:41 AM UTC

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions