Skip to content

feat: add support for instructions and annotations#130

Open
iamacook wants to merge 2 commits intowevm:mainfrom
iamacook:aaron/mcp-instructions-annotations
Open

feat: add support for instructions and annotations#130
iamacook wants to merge 2 commits intowevm:mainfrom
iamacook:aaron/mcp-instructions-annotations

Conversation

@iamacook
Copy link
Copy Markdown

Summary

Adds two new capabilities to the MCP integration: server-level instructions and per-command annotations and instructions.

Server instructions

Pass instructions to Cli.create() under the mcp key to surface guidance to the AI agent at the server level. These appear in the MCP initialize response and help agents understand how to use the CLI as a whole before calling any tool.

Cli.create('my-cli', {
  mcp: {
    instructions: 'Always pass --dry-run before making destructive changes.',
  },
})

Tool annotations

Each command can declare MCP tool annotations, which are hints to clients about a tool's behaviour. These follow the MCP spec's ToolAnnotations interface:

cli.command('delete', {
  mcp: {
    annotations: {
      destructiveHint: true,
      idempotentHint: false,
    },
  },
  run: (c) => { ... },
})

Tool instructions

Individual commands can also carry their own instructions, surfaced to the agent in tools/list via _meta.instructions:

cli.command('deploy', {
  mcp: {
    instructions: 'Pass a valid environment name. Staging is safe; production requires confirmation.',
  },
  run: (c) => { ... },
})

Changes

  • Cli.create() mcp option gains instructions and annotations fields
  • Mcp.serve() now accepts an instructions option, passed to the McpServer constructor
  • collectTools() extracts mcp.annotations and mcp.instructions from command definitions
  • ToolEntry gains annotations and instructions fields

@l3wi
Copy link
Copy Markdown

l3wi commented Apr 23, 2026

This looks good! Would love to see it merged!

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.

2 participants