MCP Tools and MCPOptKeys Compilation Pipeline Litestar routes marked with mcp_tool or @mcp_tool compile signature types, Provide dependencies, and HTTP verb hints into JSON Schema and MCPOptKeys annotations for tools/list and tools/call. Route Declaration mcp_tool=True | "name" @mcp_tool(...) / @mcp.tool() mcp_annotations={...} / annotations={...} mcp_output_schema={...} / output_schema={...} task=True | "required" | "optional" HTTP verb -> readOnly/idempotent hints Registry Schema Builder Registry.register_tool() Extracts msgspec / Pydantic / dataclass Strips Dishka & internal DI params Precedence: description > summary > doc Applies include/exclude tag filters litestar mcp export-tool-spec JSON-RPC Execution tools/list & tools/call Dispatches via internal ASGI scope Emits structuredContent when typed Supports MCPRequestContext.report_progress Handles params._meta / task async execution isError: true on 4xx/5xx tool errors
MCP Resources and RFC 6570 URI Templates Pipeline Static resources and parameterized RFC 6570 URI templates register in the MCP Registry, supporting resources/list, resources/templates/list, resources/read, and subscriptions/listen SSE & notify_resource_updated. Resource & Template Opts mcp_resource="name" mcp_resource_uri="app://config" mcp_resource_template="notes://{id}" @mcp_resource / @mcp.resource() Built-in: litestar://openapi RFC 6570 Level 1 Path Variables URI Matcher & Subscriptions Registry Resource Index Compiles URI regex & param extractors Infers MIME type (application/json) Tracks active URI subscriptions Optional ChannelsPlugin fan-out notify_resource_updated(uri) Resource JSON-RPC Surface resources/read & list resources/list (static URIs) resources/templates/list (RFC 6570) subscriptions/listen SSE & notify_resource_updated Returns text or base64 blob contents notifications/resources/updated
MCP Prompts and PromptController Compilation Pipeline Prompts declared via route markers, @mcp_prompt, or class-based PromptController resolve dependencies through Litestar and Dishka DI during prompts/get. Prompt Authoring PromptController / @mcp_prompt Route opt: mcp_prompt="name" Class-based PromptController Universal DI: Provide / FromDishka[T] Dependency() & Parameter() markers Controller-level guards & dependencies Prompt Argument Schema PromptArgument Extraction Excludes DI & Request parameters Derives required/optional arguments Parses Google docstring Args table Supports completion suggestions completion/complete handler Prompt Message Normalization prompts/list & prompts/get Executes within ASGI request scope Normalizes str, dict, or list[dict] Produces role + TextContent blocks Enforces controller & route guards messages: [{role, content}]
Agent Skills SEP-2640 and SkillSource Pipeline MCPSkillsConfig combines static FilesystemSkillSource directories, request-aware SkillSource plugins, and SkillController classes into the io.modelcontextprotocol/skills extension and skill:// resources. Skill Sources (SEP-2640) MCPSkillsConfig paths=[Path("skills")] (SKILL.md) sources=[CustomSkillSource()] SkillController & @skill_handler Skill.build() & Skill.from_content() SkillFile.from_content() + SHA-256 Request-Aware Resolution SkillCatalog Passes Request + DI per invocation Tenant & user-scoped skill filtering Path traversal protection & symlink guard Parses YAML frontmatter & manifest io.modelcontextprotocol/skills Dual Discovery Surface skills/* & skill://* skills/list (cursor pagination) skills/get (SKILL.md + file manifest) resources/read skill://{name}/{path} expose_as_resources: skill://{name}/SKILL.md skill://{name}/{path} resource files