get_hours to the starter. You will call it from the CLI, then make the same
capability available in your MCP server and messaging agent.
Before you start
Create a project with the quickstart. The starter already importstool and z
in src/tools.ts and exports a tools array.
Add a tool
Add this definition inside the existingtools array in src/tools.ts. Keep the other
starter tools so its existing commands and test scenarios continue to work.
src/tools.ts — add to the tools array
run can call
your API or database and return its result.
Call it
Restart the MCP server to load your change, then call the tool in another terminal:First terminal
Second terminal
Result
get_hours too. Restart npm start to use
it in the playground, then ask “What time do you open?”
What each field does
signIn: "none" makes this public information available without a login. Use the default
"required" for account data and configure authentication on the MCP server or
messaging agent. Hints describe behavior to a host; your tool code still enforces permissions.Add input
Describe the input a person would naturally ask for. Zod validates it beforerun is called.
For a tool that looks up a product, the input could be:
Input schema
Format tool results
In Framework 0.8.0, a tool can provide Markdown for people while retaining structured data for models and scripts. Add these fields to a tool whoserun returns the matching object:
Tool result
{ order_id: "BL-1040", ready_by: "10:30" } produces the text
**Order BL-1040** is ready by 10:30. MCP returns it in content alongside the data in
structuredContent; the CLI prints it by default. Messaging
models still receive the data. format requires output and runs after output validation.
Use the caller’s account
run receives a second argument, context, supplied by the framework. Use its verified
identity to find the account, rather than asking a model to provide an account id.
The authentication guide
shows how to connect your existing login and credentials provider.
Share a status during a slow operation
Hosts that support status text can show a short line while a tool runs and when it finishes:Tool metadata
deadlineMs limits how
long a reply waits for one tool; it does not replace an API client’s own timeout.
Validate your change
Terminal
Teach a workflow
Explain when and how an agent should use your tools.
Customize the CLI
Choose command names, arguments and output for your product.