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
- Define typed output structs for the
status and compile tools (e.g., StatusOutput, CompileOutput)
- Change the tool registration to use these output types:
mcp.AddTool[StatusInput, StatusOutput](...)
- Return the populated struct instead of
nil as the second return value
- 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
Generated by Plan Command for issue #discussion #30108 · ● 308.5K · ◷
Objective
Populate the second (structured) return value in MCP tool handlers so AI clients can parse
structuredContentdirectly instead of re-parsing embedded JSON text.Context
From discussion #30108 (Go Fan module review): all 10 tool handlers currently return
nilas the structured output:The SDK's
AddTool[In, Out]generic pattern is designed so that whenOutis a typed struct, the SDK automatically populatesstructuredContent. AI clients parse this more reliably than raw JSON text.Approach
statusandcompiletools (e.g.,StatusOutput,CompileOutput)mcp.AddTool[StatusInput, StatusOutput](...)nilas the second return valueFiles to Modify
pkg/cli/mcp_server.go— update tool registrations and handler return valuespkg/cli/mcp_server_test.go(or integration tests) — validate structured content is populatedAcceptance Criteria
statustool returns a populated typed struct as structured outputcompiletool returns a populated typed struct as structured outputstructuredContentis non-nilmake test-unitpasses