feat: add get_event_type_settings MCP tool for team event types#101
feat: add get_event_type_settings MCP tool for team event types#101joeauyeung wants to merge 6 commits into
Conversation
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Instead of cherry-picking specific RR fields, pass through the raw API response so the tool surfaces whatever event type settings the Cal.com API exposes. Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
Renames the MCP tool to better reflect its purpose — it returns full event type settings, not just round-robin configuration. Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
There was a problem hiding this comment.
Devin Review found 4 potential issues.
⚠️ 2 issues in files not directly in the diff
⚠️ New tool missing from the README tool table, violating mandatory metadata update rule (apps/mcp-server/README.md:203-212)
The new event-type-settings tool is registered (register-tools.ts:298-308) but not added to the README tool table (apps/mcp-server/README.md:203-212), so the documented tool count and discovery table are stale.
Impact: Developers and LLM clients relying on the README for tool discovery won't know this tool exists.
Rule violation and required changes
The AGENTS.md rule at .agents/rules/api-mcp-openapi-contract.md states:
When a change affects what a tool can do or how it is discovered, update all of:
- The tool tables in
apps/mcp-server/README.md.
The README at apps/mcp-server/README.md:203 still says "### Event Types (7)" and the table doesn't include get_event_type_settings. It should be updated to "(8)" and include a row for the new tool.
⚠️ New tool missing from server instructions, violating mandatory metadata update rule (apps/mcp-server/src/server-instructions.ts:9)
The new event-type-settings tool is registered but not mentioned in the server instructions (apps/mcp-server/src/server-instructions.ts:9), so LLM clients won't know they can retrieve full event type settings.
Impact: LLM clients won't discover or use the new tool since the capabilities list doesn't mention it.
Rule violation and required changes
The AGENTS.md rule at .agents/rules/api-mcp-openapi-contract.md states:
When a change affects what a tool can do or how it is discovered, update all of:
- Server instructions in
apps/mcp-server/src/server-instructions.ts.
The CAPABILITIES section at apps/mcp-server/src/server-instructions.ts:9 says "List, create, update, and delete event types" but doesn't mention the new ability to get full event type settings (including org-scoped team event types). The get_event_type_settings tool should be listed alongside the other event type capabilities.
| export async function getEventTypeSettings(params: { | ||
| eventTypeId: number; | ||
| orgId?: number; | ||
| teamId?: number; | ||
| }) { | ||
| try { | ||
| const path = | ||
| params.orgId !== undefined && params.teamId !== undefined | ||
| ? `organizations/${params.orgId}/teams/${params.teamId}/event-types/${params.eventTypeId}` | ||
| : `event-types/${params.eventTypeId}`; | ||
|
|
||
| const data = await calApi(path); | ||
| return ok(data); | ||
| } catch (err) { | ||
| return handleError("get_event_type_settings", err); | ||
| } | ||
| } |
There was a problem hiding this comment.
🔍 New tool is functionally identical to get_event_type for non-org calls
When called without orgId/teamId, getEventTypeSettings at apps/mcp-server/src/tools/event-types.ts:484 calls calApi("event-types/${params.eventTypeId}") — which is exactly what getEventType at apps/mcp-server/src/tools/event-types.ts:56 does. The test at apps/mcp-server/src/tools/event-types.test.ts:208 confirms this overlap. The only differentiation is the org-scoped path when both orgId and teamId are provided. It may be worth clarifying in the tool description that this tool's primary value-add is the org-scoped lookup, or consider whether the org-scoping should be added to the existing get_event_type tool instead of creating a new one.
Was this helpful? React with 👍 or 👎 to provide feedback.
|
❌ Cannot revive Devin session - the session is too old. Please start a new session instead. |
1 similar comment
|
❌ Cannot revive Devin session - the session is too old. Please start a new session instead. |
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
dhairyashiil
left a comment
There was a problem hiding this comment.
I agree with the existing Devin/Cubic findings on the partial orgId/teamId handling and the missing README/server-instruction updates. One additional blocker I found while checking this against the OpenAPI/source contract:
The new org-scoped path in get_event_type_settings calls organizations/{orgId}/teams/{teamId}/event-types/{eventTypeId}, but the MCP server default OAuth scopes do not include TEAM_EVENT_TYPE_READ. Cal's controller for that endpoint requires TEAM_EVENT_TYPE_READ, so HTTP/OAuth users will fail the advertised org-scoped use case unless they manually override CAL_OAUTH_SCOPES.
Evidence:
apps/mcp-server/src/tools/event-types.tsroutes toorganizations/${orgId}/teams/${teamId}/event-types/${eventTypeId}when both IDs are provided.apps/mcp-server/src/config.tsdefaultcalOAuthScopesdoes not includeTEAM_EVENT_TYPE_READ.- Cal source requires
@OAuthPermissions(["TEAM_EVENT_TYPE_READ"])forGET /v2/organizations/{orgId}/teams/{teamId}/event-types/{eventTypeId}.
Please add the required scope to the default OAuth scope list, and keep the existing Devin/Cubic fixes for partial org/team inputs and MCP discovery docs.
… for get_event_type_settings Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
|
Addressed the remaining review findings in 9ddc641:
Local lint, typecheck, and the mcp-server unit tests pass. |
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
Summary
Adds
get_event_type_settingsMCP tool that fetches an event type and returns the full settings as exposed by the Cal.com v2 API — including scheduling type, hosts, locations, booking fields, limits, and all other configuration.Supports org-scoped team event types via
orgId+teamIdparams (routes to/v2/organizations/{orgId}/teams/{teamId}/event-types/{eventTypeId}). The response is passed through without transformation.Registered with
READ_ONLYannotations. 4 unit tests cover: full passthrough, org-scoped path routing, arbitrary settings passthrough, and error handling.Link to Devin session: https://app.devin.ai/sessions/973bb70e965b4c4e9def15bc7fc5012b
Requested by: @joeauyeung