Tools are callable functions that the Shob AI agent can invoke during a session to take actions — querying a database, calling an external API, reading proprietary file formats, or anything else your workflow requires. You define them in a plugin, and Shob automatically makes them available alongside its built-in tools. The agent decides when to use a tool based on the description you provide.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/shobcoder/shob/llms.txt
Use this file to discover all available pages before exploring further.
How tools work
When a session runs, Shob sends the full list of available tools (built-in + plugin-defined) to the LLM with each request. The model analyses the current task, picks appropriate tools, and generates structured call requests. Shob validates the arguments, executes the tool’sexecute function, and feeds the result back to the model to continue the conversation.
A tool has three parts:
description— A plain-English explanation of what the tool does and when to use it. The LLM reads this to decide whether to call the tool.args— A Zod schema that defines the tool’s input parameters. Shob uses this to validate arguments from the model and generate JSON Schema for the LLM.execute— An async function that receives the validated arguments and aToolContext, performs the work, and returns a result.
The tool helper
The @shob-ai/plugin package exports a tool helper function that creates a ToolDefinition with full TypeScript inference:
Signature
tool function is generic over Args — a Zod raw shape object — so execute receives a fully typed args parameter.
Zod schema access
tool.schema is a re-export of zod, so you can build schemas without a separate import:
ToolContext
The second argument to every execute function provides session and project context:
The ID of the session that triggered the tool call.
The ID of the message that contains this tool call.
The name of the agent running the session.
The absolute path to the current project directory. Prefer this over
process.cwd() when resolving relative paths.The root of the project’s Git worktree. Useful for computing stable relative paths (e.g.
path.relative(context.worktree, absPath)).An
AbortSignal that fires when the session is aborted. Pass it to any long-running async operations (e.g. fetch) so they are cancelled cleanly.Call this at any time during execution to update the tool’s display title and metadata in the chat UI. Useful for streaming progress updates.
Request a permission approval from the user before performing a destructive or sensitive action. The call suspends until the user responds; if the permission is denied, it throws.
ToolResult
The value returned from execute can be a plain string or a richer object:
The text result sent back to the LLM. Keep this concise and structured (JSON, tables, key-value pairs) so the model can parse it easily.
A short human-readable title shown in the chat UI for this tool invocation.
Arbitrary metadata stored with the tool call result. Not sent to the LLM.
File attachments to include with the result. Each attachment has
type: "file", a mime type, a url, and an optional filename.Registering tools in a plugin
Return atool map from your plugin’s server function under the tool key of the Hooks object. Each key becomes the tool’s identifier:
Complete example
Here is a complete plugin that registers three custom tools:Tool naming conventions
Shob tool identifiers follow these conventions:- Snake case — use
underscore_separated_words, e.g.read_project_config. - Verb-first — start with an action:
read_,write_,query_,fetch_,list_,run_. - Namespaced — prefix with your domain when ambiguous:
db_query,gh_fetch_issue,stripe_list_charges. - Unique — tool IDs must be unique across all loaded plugins. If two plugins register the same ID, the last one wins.
How the agent decides to use a tool
The LLM chooses tools based entirely on thedescription field. Write descriptions that clearly answer:
- What does the tool do? — one concise sentence.
- When should it be used? — describe the use case or trigger.
- What does it return? — briefly describe the output format.
- What are the limitations? — mention things the tool cannot or should not do.
“Query the project’s PostgreSQL database with a read-only SQL SELECT statement. Use this when you need to inspect data or verify state. Returns results as a JSON array (max 50 rows). Do not use for INSERT, UPDATE, or DELETE operations.”A bad description:
“Runs SQL.”
Example use cases
| Use case | Tool design |
|---|---|
| Database inspection | Accept a SQL string, enforce read-only, return JSON rows. |
| External API calls | Accept typed parameters, pass ctx.abort to fetch, return structured JSON. |
| Custom file parsing | Accept a relative path, read with ctx.directory, return parsed content. |
| Build system integration | Run make, cargo build, etc. via ctx.$ (the BunShell), return stdout/stderr. |
| Secret/config lookup | Read from a vault or environment and inject values; never return secrets in output. |
| Issue/ticket tracking | Accept an ID, call an API, return structured ticket data for the agent to act on. |