Skip to content

Add MCP doctor for deterministic parameter resolution - #16

Open
binrogithub wants to merge 1 commit into
masterfrom
codex/create-doctor.py-for-resolving-parameters
Open

Add MCP doctor for deterministic parameter resolution#16
binrogithub wants to merge 1 commit into
masterfrom
codex/create-doctor.py-for-resolving-parameters

Conversation

@binrogithub

Copy link
Copy Markdown
Owner

Motivation

  • Provide a deterministic way to resolve missing MCP parameters into explicit values using a simple, auditable algorithm.
  • Prefer existing explicit context values, then user/vendor tagged defaults, and finally a stable tie-break among remaining candidates.
  • Ensure resolution logic performs only read-only listing calls supplied by callers and returns both a ctx_patch and human-readable explanations.

Description

  • Add package scaffolding with hc_agent and hc_agent/mcp and introduce hc_agent/mcp/doctor.py implementing the resolution logic.
  • Implement Candidate and Resolution dataclasses to represent candidate items and resolution results.
  • Add helper functions _coerce_candidate and _stable_key and the main API resolve_missing_parameters which takes ctx, missing, and list_calls and returns a Resolution.
  • Add apply_ctx_patch to apply returned patches and use DEFAULT_TAGS (which can be overridden) to prefer tagged defaults before applying a stable tie-break.

Testing

  • No automated tests were run for this change.

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 094a52490b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread hc_agent/mcp/doctor.py
default_tags: Optional override for which tags represent defaults.
"""

tags = default_tags or DEFAULT_TAGS

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor explicit empty default_tags override

When callers pass an empty set to default_tags to disable tagged-default preference, tags = default_tags or DEFAULT_TAGS treats the empty set as falsy and silently falls back to DEFAULT_TAGS. This makes it impossible to opt out of tagged defaults, and the resolution will still prefer tagged candidates even though the API suggests the override should be honored. Use an explicit if default_tags is None check so set() is respected.

Useful? React with 👍 / 👎.

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