Skip to content

feat: expose semantic MCP tools#593

Open
thymikee wants to merge 16 commits into
mainfrom
feat/semantic-mcp-tools
Open

feat: expose semantic MCP tools#593
thymikee wants to merge 16 commits into
mainfrom
feat/semantic-mcp-tools

Conversation

@thymikee
Copy link
Copy Markdown
Member

@thymikee thymikee commented May 26, 2026

Summary

Expose agent-device mcp as 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 CommandDefinition metadata 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 ran git diff --check.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 26, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://callstackincubator.github.io/agent-device/pr-preview/pr-593/

Built to branch gh-pages at 2026-05-26 20:28 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Copy link
Copy Markdown

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

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: 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".

Comment thread src/commands/semantic-common.ts Outdated
Comment on lines +160 to +163
return compactRecord({
...commandOptions,
...commonToClientOptions(readCommonInput(record)),
}) as TOptions;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Comment thread src/mcp/server.ts

async function handleMcpBatch(messages: JsonRpcMessage[]): Promise<JsonRpcResponse[] | null> {
const responses = (
await Promise.all(messages.map(async (message) => await handleMcpMessage(message)))
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 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 👍 / 👎.

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