Complete "Tools that are private to Apps" pattern documentation
Document the `_meta.ui.visibility: ["app"]` feature in `docs/patterns.md` by referencing the existing type-checked example from `src/server/index.examples.ts#registerAppTool_toolVisibility`. - Fix typo: `["apps"]` → `["app"]` (singular) - Remove placeholder function from `docs/patterns.ts` - Expand description to explain use cases Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
78b24ae2ac
commit
7c3d1e817f
2 changed files with 20 additions and 24 deletions
|
|
@ -6,11 +6,11 @@ title: Patterns
|
|||
|
||||
This document covers common patterns and recipes for building MCP Apps.
|
||||
|
||||
## [TODO] Tools that are private to Apps
|
||||
## Tools that are private to Apps
|
||||
|
||||
Use `Tool._meta.ui.visibility: ["apps"]` to make tools only visible to Apps.
|
||||
Set {@link types!McpUiToolMeta.visibility Tool.\_meta.ui.visibility} to `["app"]` to make tools only callable by Apps (hidden from the model). This is useful for UI-driven actions like updating quantities, toggling settings, or other interactions that shouldn't appear in the model's tool list.
|
||||
|
||||
{@includeCode ./patterns.ts#privateTools}
|
||||
{@includeCode ../src/server/index.examples.ts#registerAppTool_appOnlyVisibility}
|
||||
|
||||
## [TODO] Authenticated calls from App
|
||||
|
||||
|
|
|
|||
|
|
@ -9,17 +9,6 @@
|
|||
|
||||
import { App } from "../src/app.js";
|
||||
|
||||
// TODO: Add imports as patterns are implemented
|
||||
|
||||
/**
|
||||
* Example: Tools that are private to Apps
|
||||
*/
|
||||
function privateTools() {
|
||||
//#region privateTools
|
||||
// TODO: Tool._meta.ui.visibility: ["apps"]
|
||||
//#endregion privateTools
|
||||
}
|
||||
|
||||
/**
|
||||
* Example: Authenticated calls from App
|
||||
*/
|
||||
|
|
@ -121,7 +110,6 @@ function migrateFromOpenai() {
|
|||
}
|
||||
|
||||
// Suppress unused variable warnings
|
||||
void privateTools;
|
||||
void authenticatedCalls;
|
||||
void errorsToModel;
|
||||
void hostStyling;
|
||||
|
|
|
|||
Loading…
Reference in a new issue