feat: expose semantic MCP tools#593
Conversation
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cb650cfeba
ℹ️ 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".
| return compactRecord({ | ||
| ...commandOptions, | ||
| ...commonToClientOptions(readCommonInput(record)), | ||
| }) as TOptions; |
There was a problem hiding this comment.
Preserve element target when deviceTarget is present
readClientOptions currently spreads commonToClientOptions after command-specific fields, and commonToClientOptions maps deviceTarget onto target. For commands that also use a semantic element target object (notably get/longpress), providing deviceTarget overwrites that object with a string, so downstream target conversion throws (Expected target to be an object). This is a behavioral regression for requests that select both a device form and an element target.
Useful? React with 👍 / 👎.
|
|
||
| async function handleMcpBatch(messages: JsonRpcMessage[]): Promise<JsonRpcResponse[] | null> { | ||
| const responses = ( | ||
| await Promise.all(messages.map(async (message) => await handleMcpMessage(message))) |
There was a problem hiding this comment.
Process JSON-RPC batch messages in order
Using Promise.all here executes all batch entries concurrently, which makes dependent mutating requests race each other (for example, open and then click in one JSON-RPC batch can run out of order and fail with no active session). The previous implementation handled batch entries serially, and this parallelization changes MCP into a concurrent execution path for stateful session commands.
Useful? React with 👍 / 👎.
Summary
Expose
agent-device mcpas a first-class semantic tool server instead of discovery-only metadata. CLI, MCP, and the Node client now share semantic command contracts plus a single semantic grammar layer for CLI input, batch steps, and daemon request projection.Deletes the old command codec/request helpers, the legacy
CommandDefinitionmetadata layer, local-only MCP placeholder tools, and thin dedicated CLI wrapper modules that only delegated into semantic execution. CLI help schemas now live with CLI help, capability decisions live with capabilities, and MCP tools are generated from semantic command contracts.Updates agent setup docs with copy-paste Cursor and Claude paths for CLI-only and MCP workflows.
Touched-file count: 61. Scope is the CLI/MCP/Node interface layer; daemon architecture and platform handlers are preserved.
Validation
Ran
pnpm format,pnpm check:quick,pnpm check:fallow --base origin/main, and focused Vitest coverage for CLI help, semantic grammar, client routing, batch CLI, daemon grammar consumers, and MCP tools:pnpm exec vitest run src/utils/__tests__/args.test.ts src/__tests__/semantic-grammar.test.ts src/__tests__/cli-batch.test.ts src/__tests__/cli-client-commands.test.ts src/__tests__/client.test.ts src/daemon/handlers/__tests__/interaction-touch-targets.test.ts src/daemon/handlers/__tests__/snapshot.test.ts src/mcp/__tests__/router.test.ts src/mcp/__tests__/semantic-tools.test.ts. Also rangit diff --check.