@octavus/docs 3.6.0 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -106,6 +106,36 @@ tools: {
106
106
 
107
107
  The handler also receives Zod-validated arguments. Invalid inputs throw before reaching your code, with the failed paths and messages joined into the error.
108
108
 
109
+ ## Declaring an Output Schema
110
+
111
+ `defineInlineMcpTool()` accepts an optional `output` Zod schema. When provided, two things happen:
112
+
113
+ 1. The schema is converted to JSON Schema and forwarded to the LLM as `outputSchema`. Providers that support structured tool outputs (e.g. OpenAI strict mode) can use it to validate the tool result they reason over.
114
+ 2. Handler return values are validated against the schema at runtime. A handler returning a malformed result throws before the result reaches the LLM, with the failed paths and messages joined into the error.
115
+
116
+ ```typescript
117
+ 'get-pr-overview': defineInlineMcpTool({
118
+ description: 'Get pull request metadata and file changes',
119
+ parameters: z.object({
120
+ owner: z.string(),
121
+ repo: z.string(),
122
+ pullNumber: z.number(),
123
+ }),
124
+ output: z.object({
125
+ title: z.string(),
126
+ state: z.enum(['open', 'closed', 'merged']),
127
+ additions: z.number(),
128
+ deletions: z.number(),
129
+ }),
130
+ handler: async (args) => {
131
+ // Return type is type-checked against the `output` schema.
132
+ return await githubService.getPrOverview(args.owner, args.repo, args.pullNumber);
133
+ },
134
+ }),
135
+ ```
136
+
137
+ Omitting `output` preserves the previous behavior - the handler return type is unconstrained and the LLM sees no `outputSchema` on the tool.
138
+
109
139
  ## Attaching to a Session
110
140
 
111
141
  Pass inline MCP servers via `mcpServers` on `attach()`. They merge with `tools` and survive across `setDynamicTools()` calls: