Skip to content

Commit 268bab1

Browse files
committed
fix(mcp): accept agent_id on create_card
- the agent MCP client injects agent_id into every call; create_card alone lacked the field, so the strict (additionalProperties:false) schema rejected the orchestrator's subtask creation with "unexpected additional properties [agent_id]" - add agent_id for parity with the other card tools; regression test
1 parent 6128d10 commit 268bab1

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

internal/mcp/server_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,31 @@ func TestCreateAndGetCard(t *testing.T) {
225225
assert.Equal(t, created.Priority, fetched.Priority)
226226
}
227227

228+
// The agent MCP client injects agent_id into every call (universal
229+
// attribution). create_card must accept it like the other card tools, or the
230+
// orchestrator's subtask creation is rejected at schema validation with
231+
// "unexpected additional properties [agent_id]".
232+
func TestCreateCardAcceptsAgentID(t *testing.T) {
233+
env := setupMCP(t)
234+
235+
result, err := env.session.CallTool(context.Background(), &mcp.CallToolParams{
236+
Name: "create_card",
237+
Arguments: map[string]any{
238+
"project": "test-project",
239+
"title": "Subtask from agent",
240+
"type": "task",
241+
"priority": "medium",
242+
"agent_id": "cmx-agent-test-001",
243+
},
244+
})
245+
require.NoError(t, err, "create_card must accept agent_id (the agent injects it on every call)")
246+
require.False(t, result.IsError, "create_card with agent_id should not error")
247+
248+
var card board.Card
249+
unmarshalResult(t, result, &card)
250+
assert.Equal(t, "Subtask from agent", card.Title)
251+
}
252+
228253
func TestUpdateCard(t *testing.T) {
229254
env := setupMCP(t)
230255

internal/mcp/tools_cards.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ type createCardInput struct {
4444
Body string `json:"body,omitempty" jsonschema:"optional markdown body"`
4545
Parent string `json:"parent,omitempty" jsonschema:"parent card ID for subtasks"`
4646
DependsOn []string `json:"depends_on,omitempty" jsonschema:"card IDs this depends on"`
47+
// AgentID is accepted for parity with the other card tools: the agent MCP
48+
// client injects agent_id into every call, so create_card must declare it or
49+
// the strict (additionalProperties:false) schema rejects the orchestrator's
50+
// subtask creation. Not threaded to attribution today (the service has no
51+
// author param); present so the call validates.
52+
AgentID string `json:"agent_id,omitempty" jsonschema:"caller identity (accepted for client parity; not used for attribution)"`
4753
}
4854

4955
// NOTE: vetted, autonomous, feature_branch, create_pr, and model pin fields

0 commit comments

Comments
 (0)