Documentation
¶
Overview ¶
Command ok-plugin-example is a reference OK plugin: a minimal MCP stdio server speaking newline-delimited JSON-RPC 2.0 on stdin/stdout. It exists to document the contract end-to-end (the protocol the internal/plugin client drives) and to give users a working example to copy.
Wire it up in ok.toml:
[[plugins]] name = "example" command = "ok-plugin-example"
Then ok surfaces its tools as "mcp__example__echo" / "mcp__example__wordcount", its prompt as the "/mcp__example__review" slash command, and its resource as the "@example:doc://style-guide" reference.
Protocol, one JSON object per line:
- initialize → {protocolVersion, capabilities, serverInfo}
- notifications/initialized (notification, no id) → ignored
- tools/list → {tools: [{name, description, inputSchema, annotations}]}
- tools/call {name, arguments} → {content: [{type:"text", text}], isError}
- prompts/list → {prompts: [{name, description, arguments}]}
- prompts/get {name, arguments} → {messages: [{role, content:{type,text}}]}
- resources/list → {resources: [{uri, name, description, mimeType}]}
- resources/read {uri} → {contents: [{uri, mimeType, text}]}
Logs go to stderr (ok forwards plugin stderr to the terminal); stdout is reserved for JSON-RPC so it must never carry stray prose.
Click to show internal directories.
Click to hide internal directories.