Skip to content

fix(mcp): hide hog function inputs and reject no-field exclusions - #115571

Closed
Silthus wants to merge 1 commit into
PostHog:masterfrom
Silthus:upstream/mcp-validate-exclusions
Closed

Silthus wants to merge 1 commit into
PostHog:masterfrom
Silthus:upstream/mcp-validate-exclusions

Conversation

@Silthus

@Silthus Silthus commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Problem

  • Agents using the cdp-functions-create, cdp-functions-partial-update, error-tracking-alerts-create and error-tracking-alerts-partial-update MCP tools can set four internal input fields: templating, order, bytecode and transpiled.
  • The product YAML lists them as excluded (inputs.*.templating), but the generated schema still exposes them. The * segment steps only into arrays, and inputs is a dict.
  • Nothing reports an exclude_params entry that names no field, so a typo or a stale name also leaves a field exposed.

Supersedes #112291 (closed), rebased on current master. Fork handoff: Silthus/posthog#346. The open draft #112861 stacks on #112291 and can rebase onto this PR.

Note

🔵 Merge risk: low · two-way door (merge-risk rubric)

  • Four MCP tool schemas lose internal fields, which agents should never set. The API itself does not change.
  • Codegen now fails on a stale exclusion. Every remaining entry on master names a real field, so the next regeneration passes.

Changes

  • The four hog function tools no longer accept templating, order, bytecode or transpiled on inputs.* and mappings.*.inputs.*.
  • A * in an exclusion path now steps into dict values (additionalProperties) as well as array items.
  • MCP codegen fails when an exclude_params entry names no query parameter or request body path. The error names the tool and the entry.
  • Path parameters do not count, because the generator never removes them. An entry for a read-only body field still passes, because Orval already drops it.
  • The check found 52 stale entries in 6 product YAML files. They name response-only fields, path parameters, or parameters the operation does not take, so they hid nothing. This PR removes them, including the dashboard-update list that master kept.
  • Mechanical: the regenerated Zod files and the four tool schema snapshots, which only remove the fields above.

How did you test this code?

Test rationale: exclusions.test.mjs gains dict-traversal cases that fail on the old array-only *. generate-tools.test.ts gains cases for the no-field error. The schema snapshots prove the four fields leave the tool schemas.

  • Ran generate-tools.test.ts and exclusions.test.mjs locally on the rebased branch: they pass.
  • Ran hogli build:openapi on the rebased branch: it succeeds and changes no generated file, so no stale exclusion is left on master.

Release status

  • No feature flag controls this change

Docs update

Updated docs/published/handbook/engineering/ai/implementing-mcp-tools.md with the dict traversal and the new error.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Agent: T3 Code with Claude Code, Claude Opus 5.5 (claude-opus-5-5). Cross-family review: Codex, GPT-6.1 Sol (gpt-6.1-sol), high reasoning effort, read-only.

  • Rebuilt from the closed PR's diff on master 60187c17de7. Master expanded the dashboard-update description. That text stays, and its stale exclusion list goes.
  • Skills: writing-pr-descriptions, writing-tests, writing-code-comments, merge-risk.
  • Review: one nit, fixed. An added comment line used an em dash, so the list now uses colons. The reviewer also checked all 200 remaining product exclusions against current master and found no other stale entry.
  • Duplicate search: fix(mcp): fail codegen when a yaml setting names no field #112861 extends this check to the other YAML settings and depends on this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@trunk-io

trunk-io Bot commented Oct 12, 2026

Copy link
Copy Markdown

Merging to master in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@scheduled-actions-posthog

Copy link
Copy Markdown
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, please remove the stale label – otherwise this will be closed in another week. If you want to permanently keep it open, use the waiting label.

@scheduled-actions-posthog

Copy link
Copy Markdown
Contributor

This PR was closed due to lack of activity. Feel free to reopen if it's still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant