Skip to content

Encode tool parameters by alias, with defaults and **kwargs - #807

Open
eb8680 wants to merge 5 commits into
eb-mapping-encodingfrom
eb-tool-serialization
Open

eb8680 wants to merge 5 commits into
eb-mapping-encodingfrom
eb-tool-serialization

Conversation

@eb8680

@eb8680 eb8680 commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Blocked by #802 which includes some preliminary fixes.

This PR includes some fixes for edge cases of tool encoding which came up in adding MCP support to the harness: give each parameter a positional field aliased to its name so any parameter name round-trips, keep defaults, map **kwargs to extra fields, and drop strict mode when the schema cannot satisfy it. Update the acp plan test and PlanStep docstring, whose optional fields are no longer required.

@eb8680
eb8680 requested a review from datvo06 September 30, 2026 20:09
@eb8680
eb8680 added this pull request to stack #808 September 30, 2026 20:09
if not isinstance(schema, dict):
return False
if schema.get("type") == "object" and (
schema.get("additionalProperties") is not False

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can/should we add this schema.get("additionalProperties") not in (None, False)?
Because right now any object schema without additionalProperties: false will be counted as open.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If that's the intended design then it's fine.

Base automatically changed from codex/801-operation-typing to master September 30, 2026 20:43
@eb8680
eb8680 force-pushed the eb-tool-serialization branch 2 times, most recently from 7f3afb7 to 2c8d1e8 Compare October 1, 2026 13:26
@eb8680
eb8680 removed this pull request from stack #808 October 1, 2026 13:29
@eb8680
eb8680 changed the base branch from master to worktree-issue-762-empty-content-blocks October 1, 2026 13:29
@eb8680
eb8680 added this pull request to stack #777 October 1, 2026 13:29
@eb8680
eb8680 force-pushed the eb-tool-serialization branch from 2c8d1e8 to 436c29d Compare October 1, 2026 13:37
@eb8680
eb8680 removed this pull request from stack #777 October 1, 2026 13:40
@eb8680
eb8680 changed the base branch from worktree-issue-762-empty-content-blocks to eb-mapping-encoding October 1, 2026 13:40
@eb8680
eb8680 added this pull request to stack #812 October 1, 2026 13:41
eb8680 added 5 commits October 3, 2026 13:44
Port from eb-mcp-client: give each parameter a positional field aliased to
its name so any parameter name round-trips, keep defaults, map **kwargs to
extra fields, and drop strict mode when the schema cannot satisfy it.
Update the acp plan test and PlanStep docstring, whose optional fields are
no longer required.
An object schema that omits additionalProperties can still be closed for
strict generation, so only an explicit open schema disables strict mode.
This keeps tools whose parameters are nested dataclasses or models strict.
Dump tool results by alias, matching the aliased parameter encoding.
With mappings written as key-value pairs, a tool taking a dict has a
strict schema, so it moves to the strict cases. Keyword arguments
collected by **kwargs are encoded one keyword at a time.
A named tool is advertised through the encoding of its tool's type, so a
Tool subclass changes how it is advertised by registering an encoding.
Tools as values never reached the old source-code encoding: the harness
encodes values by nested_type, which gives Operation, not Tool.
@eb8680
eb8680 removed this pull request from stack #812 October 3, 2026 17:48
@eb8680
eb8680 force-pushed the eb-tool-serialization branch from 436c29d to 19b74fc Compare October 3, 2026 17:48
@eb8680
eb8680 added this pull request to stack #814 October 3, 2026 17:48

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants