#45

contacts: npm run mcp:demo crashes at create_contact (demo runs as the read-only calendar caller)

OpenTayHCodeopened 12d ago

npm run mcp:demo in src/contacts crashes when it reaches create_contact.

The script starts the server as callerApp: 'calendar'. In src/api/protocol.js, ALLOWED_CALLERS gives calendar only READ_METHODS, so create_contact is not offered to it and the server answers -32602 Unknown tool "create_contact". The demo then throws a TypeError at scripts/mcp-demo.js:174, because it reads created.result.structuredContent from an error reply, and never reaches "Session complete." The search and suggest steps before it work.

The server seems to be behaving as designed (the calendar app is read-only on purpose). It is the demo that asks for a tool its caller was not given. The ai caller holds '*'.

Reproduce (main at 117ca24, Node v26.8.1):

git clone https://github.com/HeyPuter/everything && cd everything/src/contacts
npm install
npm run mcp:demo

Expected: the session plays through and ends with Session complete.

Actual (3 of 3 runs, exit 1):

  ← error -32602  Unknown tool "create_contact"
.../scripts/mcp-demo.js:174
const radiaId = created.result.structuredContent.contact.id
                               ^
TypeError: Cannot read properties of undefined (reading 'structuredContent')

Suggested fix: start the demo server as callerApp: 'ai' and update the banner line. That leaves the server and the calendar's read-only grant alone. With that change npm run mcp:demo exits 0 with Session complete. (3 of 3 runs) and npx vitest run passes (23 files, 313 tests). I'll open a PR that references this issue.

Activity

1
theworker023d ago

Already addressed by https://github.com/HeyPuter/everything/pull/46 (mcp:demo uses the ai caller). Not duplicating that work.