Taias - Give your MCP server an opinion, guide your users to achieve outcomes
npm install taiasTaias is a lightweight framework that helps MCP server builders influence and shape user experiences inside LLM-driven interfaces.
``bash`
npm install taias
1. Define a flow — Map out your tool sequence:
`ts
import { defineFlow, createTaias } from "taias";
const flow = defineFlow("onboard", (flow) => {
flow.step("scan_repo", () => ({ nextTool: "configure_app" }));
flow.step("configure_app", () => ({ nextTool: "deploy" }));
});
`
2. Create a Taias instance:
`ts[Taias] No step defined for tool "${toolName}"
const taias = createTaias({
flow,
devMode: true, // Enable validation and warnings during development
onMissingStep: ({ toolName }) => {
console.warn();`
},
});
3. Append advice to your tool response:
`ts
// Inside your tool handler
const affordances = await taias.resolve({ toolName: "scan_repo" });
let message = "Scan successful!";
// Append Taias advice to guide the LLM to the next step
if (affordances?.advice) {
message += \n\n${affordances.advice};
}
return {
content: [
{
type: "text",
text: message,
},
],
};
`
Creates a flow definition.
`ts`
const myFlow = defineFlow("my_flow", (flow) => {
flow.step("tool_name", (ctx) => ({
nextTool: "next_tool_name",
}));
});
Parameters:
- flowId - Unique identifier for the flowbuilder
- - Callback receiving a FlowBuilder to define steps
Returns: FlowDefinition
Creates a Taias instance from a flow.
`tsNo next step for tool: ${ctx.toolName}
const taias = createTaias({
flow: myFlow,
devMode: true,
onMissingStep: (ctx) => {
console.log();`
},
});
Options:
- flow - A FlowDefinition created by defineFlowdevMode
- (optional) - Enable development mode checksonMissingStep
- (optional) - Callback invoked when no step matches
Returns: Taias instance
Resolves a tool call to get the suggested next step. Advice text to send the LLM is generated based on the nextTool specified in your step handler.
`ts`
const affordances = await taias.resolve({ toolName: "scan_repo" });
// affordances.advice → "FOR THE BEST USER EXPERIENCE, TELL THE USER TO USE THE configure_app TOOL NEXT!!!!!"
> The emphasis helps LLMs prioritize it.
Parameters:
- ctx.toolName - The name of the tool being called
Returns: Affordances | nullAffordances
- Returns an object with advice (and more) if a matching step is foundnull
- Returns if no step matches or handler returns null
See the full documentation for complete API reference and types.
View dev mode features
When devMode: true, Taias performs additional validation:
1. Duplicate toolName detection — Throws an error if a flow defines the same tool name twice:
``
Taias: Duplicate step for tool 'scan_repo' in flow 'onboard_repo'. Only one handler per tool is supported.
2. Empty nextTool warning — Logs a warning if a handler returns empty nextTool:
```
Taias: nextTool for tool 'scan_repo' is empty.
See the full documentation for more details.