Skip to content

feat(mcp): let agents (MCP) reach models - #19

Draft
alesgenova wants to merge 1 commit into
mainfrom
feat-mcp
Draft

alesgenova wants to merge 1 commit into
mainfrom
feat-mcp

Conversation

@alesgenova

Copy link
Copy Markdown
Member

Depends on:

StateDataModel now inherits trame-common's MCPExposable mixin, so models are objects agents reach through trame-server's object tools.

  • the mcp= class keyword and mcp_describe() take the options every class has, plus the model's own: all_fields (every Sync and ClientOnly field) and constructor (how agents create models)
  • Sync, ClientOnly and ServerOnly take mcp= to expose one field, with options. ClientOnly fields are read-only by default, and an exposed ServerOnly field must state read_only
  • @mcp_constructor marks the classmethod agents create models with; it is also exported from trame.app.dataclass
  • the hooks trame-server calls describe the fields and the constructor (trame_dataclass/mcp.py), and wait for watchers after a change
  • model ids come from trame-common's generator, shared with components: lowercase hex such as "0x1f" instead of base-62

Requires trame-common 1.3.0. The tests of agent access also need trame-server 4.2.0.

StateDataModel now inherits trame-common's MCPExposable mixin, so models
are objects agents reach through trame-server's object tools.

- the mcp= class keyword and mcp_describe() take the options every
  class has (constructor included), plus the model's own: all_fields
  (every Sync and ClientOnly field)
- Sync, ClientOnly and ServerOnly take mcp= to expose one field, with
  options. ClientOnly fields are read-only by default, and an exposed
  ServerOnly field must state read_only
- the hooks trame-server calls describe the fields
  (trame_dataclass/mcp.py), which are also the parameters of the
  default constructor, and wait for watchers after a change
- model ids come from trame-common's generator, shared with components:
  lowercase hex such as "0x1f" instead of base-62

Requires trame-common 1.3.0. The tests of agent access also need
trame-server 4.2.0.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant