@critical-path/mcp 0.18.1 → 0.19.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.
- package/CHANGELOG.md +17 -0
- package/README.md +70 -25
- package/dist/bin/args.d.ts +8 -0
- package/dist/bin/args.d.ts.map +1 -1
- package/dist/bin/args.js +20 -0
- package/dist/bin/args.js.map +1 -1
- package/dist/bin/cli.js +37 -3
- package/dist/bin/cli.js.map +1 -1
- package/dist/bin/skills.d.ts +15 -0
- package/dist/bin/skills.d.ts.map +1 -0
- package/dist/bin/skills.js +28 -0
- package/dist/bin/skills.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/server/index.d.ts +6 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +27 -13
- package/dist/server/index.js.map +1 -1
- package/dist/skills/catalog.generated.d.ts +3 -0
- package/dist/skills/catalog.generated.d.ts.map +1 -0
- package/dist/skills/catalog.generated.js +33 -0
- package/dist/skills/catalog.generated.js.map +1 -0
- package/dist/skills/index.d.ts +13 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +7 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/tools/definitions.d.ts +82 -8
- package/dist/tools/definitions.d.ts.map +1 -1
- package/dist/tools/definitions.js +296 -52
- package/dist/tools/definitions.js.map +1 -1
- package/dist/tools/instructions.d.ts +10 -0
- package/dist/tools/instructions.d.ts.map +1 -0
- package/dist/tools/instructions.js +48 -0
- package/dist/tools/instructions.js.map +1 -0
- package/dist/tools/outputs.d.ts +2311 -0
- package/dist/tools/outputs.d.ts.map +1 -0
- package/dist/tools/outputs.js +184 -0
- package/dist/tools/outputs.js.map +1 -0
- package/dist/web/index.d.ts +16 -0
- package/dist/web/index.d.ts.map +1 -1
- package/dist/web/index.js +13 -12
- package/dist/web/index.js.map +1 -1
- package/package.json +11 -6
- package/skills/analyze-schedule/SKILL.md +42 -0
- package/skills/investigate-task/SKILL.md +41 -0
- package/skills/plan-capacity/SKILL.md +32 -0
- package/skills/plan-project/SKILL.md +45 -0
- package/skills/report-status/SKILL.md +46 -0
- package/skills/triage-tasks/SKILL.md +41 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const SKILL_CATALOG = [
|
|
2
|
+
{
|
|
3
|
+
"name": "analyze-schedule",
|
|
4
|
+
"description": "Find what drives a project's end date, how much each task can slip and where people are double-booked, then recommend fixes. Use for \"when will we finish?\", \"what is critical?\" or deadline-risk questions.",
|
|
5
|
+
"content": "---\nname: analyze-schedule\ndescription: Find what drives a project's end date, how much each task can slip and where people are double-booked, then recommend fixes. Use for \"when will we finish?\", \"what is critical?\" or deadline-risk questions.\n---\n\n# Analyze the schedule\n\n## 1. Run the schedule\n\n1. Get the `projectId` (`list_projects`).\n2. Call `calculate_critical_path` with `calendars: \"assignee\"` and `levelResources: true`, so each person works on one task at a time on their own calendar. If the user wants the ideal schedule with unlimited people, call it with no options instead.\n3. If the question spans projects that share people, call `calculate_portfolio_critical_path` with their `projectIds` (and `projectOrder` if the user ranked them) instead.\n4. For in-flight projects, pass `effort: \"remaining\"` so finished hours are not scheduled again.\n\n## 2. Read the result\n\n- `projectEndDate` is the forecast finish. With levelling, compare it with `unleveledProjectEndDate`: the gap is time lost waiting for busy people.\n- `criticalTaskIds` are the tasks with zero slack. Any delay to one of them moves the end date.\n- Each entry in `tasks` has `slackWorkingHours`: how many working hours the task can slip without moving the end. Under about 8 hours is near-critical.\n- `levelingDelayHours` and `waitingOn` show a task that waited for its assignee to finish another task.\n- `overallocations` lists periods where a person (`assigneeId`) or team (`teamId`) is booked above `capacity`; `allocation` 1.5 means 150%.\n\nLook up titles for the task ids you mention with `get_task` or `list_tasks`; report titles, not ids. To see why a critical task cannot start earlier, call `get_task` with `includeDependencies: true`: `dependencies.dependsOn` lists what it waits for and `dependencies.dependents` what waits for it.\n\n## 3. Recommend\n\nRank fixes by how much they pull the end date in:\n\n1. **Unblock critical tasks.** A critical task with `isBlocked: true` delays everything; say what it waits for.\n2. **Move work off the bottleneck person.** If critical tasks wait on one assignee (`waitingOn`), suggest reassigning a non-critical task of theirs.\n3. **Remove false dependencies.** A critical task waiting on work it does not really need (`dependencies.dependsOn`) can start earlier once the link is removed.\n4. **Split long critical tasks** so parts can run in parallel.\n5. **Cut or defer** tasks feeding late deliverables, if dates are fixed.\n\nShow the recommendation to the user. Change tasks (`update_task`) or dependencies (`add_dependency`, `remove_dependency`) only when they ask, then run the schedule again to show the effect.\n\n## Report format\n\n- Forecast finish date, and against any deadline the user gave.\n- Critical path: task titles in order, with assignee.\n- Top risks: near-critical tasks, blocked critical tasks, over-allocations.\n- Recommended actions, each with its expected effect.\n"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"name": "investigate-task",
|
|
9
|
+
"description": "Work out why a specific task is late, stalled or over budget and what it puts at risk. Use when the user asks about one task's status, delay or overrun.",
|
|
10
|
+
"content": "---\nname: investigate-task\ndescription: Work out why a specific task is late, stalled or over budget and what it puts at risk. Use when the user asks about one task's status, delay or overrun.\n---\n\n# Investigate a task\n\n## 1. Identify the task\n\nIf the user named the task rather than giving its id, find it with `list_tasks` (filter by project, assignee or status) and confirm which one they mean if several match.\n\n## 2. Gather evidence\n\n1. `get_task` with `includeDependencies: true`: status, assignee, estimate, logged hours, due date, `isBlocked` and `blockedReason`, plus the tasks it waits for (`dependencies.dependsOn`, with their status) and the tasks waiting on it (`dependencies.dependents`).\n2. `get_task_metrics`: progress and variance.\n3. `get_task_ladder`: its phase (`macroPhase`) and that phase's health, and its schedule in `standard.cpm` (`isCritical`, `slackWorkingHours`).\n4. `list_comments`: what people said about it, especially recent blockers or decisions.\n\n## 3. Diagnose\n\nCheck these in order and stop at the ones that explain the problem:\n\n| Signal | Meaning |\n| --- | --- |\n| `isBlocked` true, an unfinished task in `dependencies.dependsOn`, or comments mention waiting | Blocked. Name what it waits for and its status; investigate that task the same way if it is late too. |\n| `progressHistory.curveProfile` is `stalled` | No progress recently. Check whether the assignee moved to other work. |\n| `realityDelta.isOverEstimate` true or `evm.costPerformanceIndex` below 0.9 | Taking more effort than estimated. The estimate was too low or scope grew. |\n| `evm.schedulePerformanceIndex` below 0.9 or `realityDelta.isOverdue` | Behind schedule. Give `scheduleVarianceWorkingDays`. |\n| No `estimatedHours` | Metrics cannot be trusted; say so and suggest adding an estimate. |\n| `curveProfile` is `late_rush` | Most progress lands near the deadline; the remaining work may be underestimated. |\n\n## 4. Assess the impact\n\n- If the task is critical (`standard.cpm.isCritical`), every day it slips moves the project end. Say so plainly.\n- List the tasks waiting on it (`dependencies.dependents`, by title); they slip with it.\n- Otherwise, report how much slack it has left before it becomes critical.\n- Name the phase or deliverable it endangers.\n\n## 5. Answer\n\nLead with a one-sentence diagnosis, then the evidence (with numbers), the impact, and one to three concrete next steps (unblock, re-estimate, reassign, split). Change the task with `update_task` or record the finding with `add_comment` only if the user asks.\n"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "plan-capacity",
|
|
14
|
+
"description": "Check who is overloaded or idle over a time window and rebalance assignments. Use for capacity planning, workload balancing or \"can we take on more work?\" questions.",
|
|
15
|
+
"content": "---\nname: plan-capacity\ndescription: Check who is overloaded or idle over a time window and rebalance assignments. Use for capacity planning, workload balancing or \"can we take on more work?\" questions.\n---\n\n# Plan capacity\n\n## 1. Measure the load\n\n1. Decide the window and grain with the user, defaulting to the next 8 weeks by `interval: \"week\"`.\n2. Call `get_workload_distribution` with `groupBy: \"assignee\"`, `metric: \"remaining\"`, `startDate` and `endDate` (YYYY-MM-DD). Pass `projectId` for one project, or omit it for the whole workspace (people usually work across projects). Use `groupBy: \"team\"` for team-level questions.\n3. If people do not work 40-hour weeks, pass `defaultWeeklyCapacityHours`.\n\n## 2. Read it\n\n- `seriesKeys` are the people (or teams); `seriesLabels` maps each to a display name.\n- In each bucket, `values[key]` is booked hours and `capacity[key]` is available hours. Load = values / capacity.\n- `utilizationRatio` above 1 is overloaded for the bucket as a whole; check each person too, since one overloaded person hides inside a team average.\n- Treat above 1.0 as overloaded, 0.8-1.0 as full, below 0.5 as spare capacity.\n- Work with no assignee (or team) appears under the key `unassigned`; it is demand nobody has picked up.\n\n## 3. Find what to move\n\n1. For each overloaded person and week, call `list_tasks` with their `assigneeId` to see the tasks behind it.\n2. Call `calculate_critical_path` (with `calendars: \"assignee\"`) for the affected project to learn which of those tasks are critical. Move non-critical tasks first; they have slack.\n3. Match each task with a person who has spare capacity in that window.\n\n## 4. Propose\n\nGive a table: task, from, to, hours moved, effect on both people's load. Note the remaining overload if it cannot be fully resolved, and the options (push dates, add people, cut scope).\n\nApply reassignments with `update_task` (`assigneeId`) only after the user approves, and record each one with `add_comment`.\n"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "plan-project",
|
|
19
|
+
"description": "Turn a goal, brief or feature list into a Critical Path project with deliverables, estimated and prioritized tasks, and the dependencies between them. Use when the user asks to plan, scope or break down work.",
|
|
20
|
+
"content": "---\nname: plan-project\ndescription: Turn a goal, brief or feature list into a Critical Path project with deliverables, estimated and prioritized tasks, and the dependencies between them. Use when the user asks to plan, scope or break down work.\n---\n\n# Plan a project\n\nTurn a goal into deliverables (dated outcomes), tasks (estimated units of work) and dependencies (which task waits for which) the scheduler can use.\n\n## 1. Find or create the project\n\n1. Call `list_projects`. If a project already matches the goal, use it and read it with `get_project` to learn its workflow status keys and custom fields.\n2. Only if none fits, and the user wants a new one, call `create_project` with a `name` and a short `key`.\n3. Call `list_tasks` with the `projectId` and `list_deliverables` to see what already exists. Do not recreate it.\n\n## 2. Draft the plan before writing anything\n\nBreak the goal down in your reply first and show it to the user:\n\n- **Deliverables**: 2-6 outcomes someone could accept or reject, each with a due date if the user gave one.\n- **Tasks** under each deliverable. Each task:\n - starts with a verb and is small enough for one person (about 2-24 hours);\n - has `estimatedHours` (effort, not elapsed time);\n - has a `priority`: `urgent` only for work that blocks others now, `high` for the critical outcome, `medium` by default, `low` for nice-to-haves;\n - lists the tasks it must wait for (its dependencies). Only add a dependency when the work truly cannot start earlier; every extra one lengthens the schedule.\n- Note anything you assumed (team size, dates, scope) as a question.\n\nAsk the user to confirm or adjust before creating anything. A plan is cheap to change in chat and tedious to change once created.\n\n## 3. Create it\n\n1. Create tasks with `create_task` (`projectId`, `title`, `description` with acceptance criteria, `estimatedHours`, `priority`, `assigneeId` if known). Leave `status` out so tasks start in the workflow's default status.\n2. Create each deliverable with `create_deliverable`, passing the ids of its tasks in `taskIds`.\n3. Add each dependency from your plan with `add_dependency`: `taskId` is the task that waits, `dependsOnTaskId` the task that must finish first. Use the ids `create_task` returned. If one is refused as circular, your plan has a loop: fix the order with the user instead of retrying.\n4. If the project already had tasks, check what they wait for with `get_task` and `includeDependencies: true` before linking new work to them.\n\n## 4. Check the result\n\n1. Call `calculate_critical_path` for the project and report the forecast `projectEndDate` and the `criticalTaskIds` (by title). If every task is critical or the end date looks too early, a dependency is probably missing or reversed.\n2. If the end date misses a deliverable's due date, say so and suggest what to cut, split or reassign. The `analyze-schedule` skill covers this in depth.\n\n## Guardrails\n\n- Never invent user ids for `assigneeId`. Leave tasks unassigned unless the user named the person and you have their id.\n- Keep the plan to what the user asked for; propose extra work as suggestions, not tasks.\n"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "report-status",
|
|
24
|
+
"description": "Write a project status report covering progress, phase health, forecast finish, risks and blockers, backed by the schedule and metrics. Use when the user asks how a project is going or wants a status update.",
|
|
25
|
+
"content": "---\nname: report-status\ndescription: Write a project status report covering progress, phase health, forecast finish, risks and blockers, backed by the schedule and metrics. Use when the user asks how a project is going or wants a status update.\n---\n\n# Report project status\n\n## 1. Collect the facts\n\n1. Get the `projectId` (`list_projects`).\n2. Call `get_timeline_ladder` with `level: \"macro\"`. It gives overall `health`, `overallProgressPercentage`, `projectedFinishDate`, task counts and `phases`, each with its own `health`, `progressPercentage` and `isCritical`.\n3. Call `calculate_critical_path` (with `effort: \"remaining\"`) for the forecast `projectEndDate` and the `criticalTaskIds`.\n4. Call `list_tasks` for blocked and urgent work: once with `priority: \"urgent\"` and scan the results (and the project's tasks) for `isBlocked: true`.\n5. For each phase that is `at_risk`, `blocked` or `overdue`, pick its most important open tasks (critical ones first) and call `get_task_metrics` on up to 5 of them.\n6. Call `list_deliverables` and compare each due date with the forecast.\n\n## 2. Interpret\n\n- Phase `health`: `on_track`, `at_risk`, `blocked`, `overdue` or `completed`.\n- Task `evm`: `schedulePerformanceIndex` (SPI) below 0.9 means behind schedule; `costPerformanceIndex` (CPI) below 0.9 means more hours than the progress justifies.\n- `realityDelta.isOverdue` and `scheduleVarianceWorkingDays` give lateness in working days.\n- `progressHistory.curveProfile`: `stalled` needs attention now; `late_rush` suggests hidden risk near the due date.\n\n## 3. Write the report\n\nKeep it short and lead with the answer.\n\n```\n**Status: <On track | At risk | Off track>**, <progress>% done, forecast finish <date> (<deadline comparison>).\n\n**Phases**\n- <phase>: <health>, <progress>% <one-line reason if not on track>\n\n**Risks and blockers**\n- <task title> (<assignee>): <what is wrong, with the number>, <what would fix it>\n\n**Deliverables**\n- <title>: due <date>, forecast <on time | late by N days>\n\n**Next steps**\n- <owner>: <action>\n```\n\nUse task titles, not ids. Name a number for every claim (dates, percentages, hours). If data is missing (no estimates, no logged hours), say so: metrics without estimates are not meaningful.\n\nOnly post the report with `add_comment` if the user asks.\n"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "triage-tasks",
|
|
29
|
+
"description": "Review new, unprioritized or stale tasks and set priority, estimate, tags and blocked state consistently. Use when the user asks to triage, groom or clean up a backlog.",
|
|
30
|
+
"content": "---\nname: triage-tasks\ndescription: Review new, unprioritized or stale tasks and set priority, estimate, tags and blocked state consistently. Use when the user asks to triage, groom or clean up a backlog.\n---\n\n# Triage tasks\n\nMake every task in scope actionable: a clear title, a priority, an estimate and an honest blocked state.\n\n## 1. Gather the tasks\n\n1. Get the `projectId` with `list_projects` if you do not have it, then `get_project` to learn the workflow status keys.\n2. Call `list_tasks` with filters that match the request, for example:\n - untriaged: `priority: \"none\"`;\n - a backlog: `status` set to the backlog key from the workflow;\n - one person's work: `assigneeId`.\n Page with `nextCursor` until it is empty, or stop at a sensible batch (about 25) and say how many remain.\n3. For tasks whose description is thin or which look blocked, read the discussion with `list_comments`.\n\n## 2. Decide, task by task\n\n| Field | Rule |\n| --- | --- |\n| `priority` | `urgent`: blocks other people now or a live problem. `high`: needed for the next deliverable. `medium`: planned work. `low`: nice to have. Reserve `urgent` for a handful of tasks. |\n| `estimatedHours` | Effort in hours. If a task is over about 24 hours, propose splitting it instead of estimating it. |\n| `tags` | Reuse tags already used in the project; do not invent a new scheme. |\n| `isBlocked` / `blockedReason` | Blocked only when work cannot continue; the reason names what it waits for. |\n| title | Starts with a verb and says the outcome. Rewrite only when it is unclear. |\n\nFlag likely duplicates (same outcome, different words) instead of deleting them.\n\n## 3. Propose, then apply\n\n1. Show the user a table: task title, current values, proposed values, one-line reason.\n2. After the user approves (all or some), apply each change with `update_task`, passing only the fields that change.\n3. For any non-obvious change, record why with `add_comment` on the task.\n\n## Guardrails\n\n- Do not change `status` or `assigneeId` during triage unless the user asked for it.\n- Never call `delete_task` during triage. Suggest canceling duplicates and let the user decide.\n"
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
//# sourceMappingURL=catalog.generated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.generated.js","sourceRoot":"","sources":["../../src/skills/catalog.generated.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,aAAa,GAAY;IACpC;QACE,MAAM,EAAE,kBAAkB;QAC1B,aAAa,EAAE,kNAAkN;QACjO,SAAS,EAAE,+4FAA+4F;KAC35F;IACD;QACE,MAAM,EAAE,kBAAkB;QAC1B,aAAa,EAAE,0JAA0J;QACzK,SAAS,EAAE,uhFAAuhF;KACniF;IACD;QACE,MAAM,EAAE,eAAe;QACvB,aAAa,EAAE,yKAAyK;QACxL,SAAS,EAAE,o+DAAo+D;KACh/D;IACD;QACE,MAAM,EAAE,cAAc;QACtB,aAAa,EAAE,kNAAkN;QACjO,SAAS,EAAE,gnGAAgnG;KAC5nG;IACD;QACE,MAAM,EAAE,eAAe;QACvB,aAAa,EAAE,iNAAiN;QAChO,SAAS,EAAE,syEAAsyE;KAClzE;IACD;QACE,MAAM,EAAE,cAAc;QACtB,aAAa,EAAE,0KAA0K;QACzL,SAAS,EAAE,8oEAA8oE;KAC1pE;CACF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A playbook an agent loads for a multi-step job. `content` is the full SKILL.md (Agent Skills
|
|
3
|
+
* format: YAML frontmatter with `name` and `description`, then markdown steps).
|
|
4
|
+
*/
|
|
5
|
+
export interface Skill {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
content: string;
|
|
9
|
+
}
|
|
10
|
+
/** Skills bundled with this package. Sources live in `skills/<name>/SKILL.md`. */
|
|
11
|
+
export declare const SKILLS: readonly Skill[];
|
|
12
|
+
export declare function getSkill(name: string): Skill | undefined;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,kFAAkF;AAClF,eAAO,MAAM,MAAM,EAAE,SAAS,KAAK,EAAkB,CAAC;AAEtD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAExD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SKILL_CATALOG } from './catalog.generated.js';
|
|
2
|
+
/** Skills bundled with this package. Sources live in `skills/<name>/SKILL.md`. */
|
|
3
|
+
export const SKILLS = SKILL_CATALOG;
|
|
4
|
+
export function getSkill(name) {
|
|
5
|
+
return SKILLS.find((skill) => skill.name === name);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAYvD,kFAAkF;AAClF,MAAM,CAAC,MAAM,MAAM,GAAqB,aAAa,CAAC;AAEtD,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -2,26 +2,58 @@ import { z } from 'zod';
|
|
|
2
2
|
import type { CriticalPathEngine } from '@critical-path/core';
|
|
3
3
|
import type { CriticalPathClient } from '@critical-path/client';
|
|
4
4
|
export type BackendContext = CriticalPathEngine | CriticalPathClient;
|
|
5
|
+
/**
|
|
6
|
+
* Groups of related tools. Hosts expose only the groups an agent needs (`toolsets` option), which
|
|
7
|
+
* keeps the tool list short and tool choice accurate.
|
|
8
|
+
*/
|
|
9
|
+
export declare const TOOLSETS: {
|
|
10
|
+
readonly core: "Projects, tasks and task dependencies: find, read, create, update and delete";
|
|
11
|
+
readonly collaboration: "Deliverables (milestones) and task comments";
|
|
12
|
+
readonly scheduling: "Critical path, portfolio scheduling and workload/capacity";
|
|
13
|
+
readonly analytics: "Project status ladder, task metrics, earned value and progress history";
|
|
14
|
+
readonly guidance: "Skills: step-by-step playbooks for multi-step jobs";
|
|
15
|
+
};
|
|
16
|
+
export type ToolsetName = keyof typeof TOOLSETS;
|
|
17
|
+
/** Standard MCP tool annotations. */
|
|
18
|
+
export interface ToolAnnotations {
|
|
19
|
+
/** The tool does not change anything. */
|
|
20
|
+
readOnlyHint: boolean;
|
|
21
|
+
/** The tool may delete or irreversibly overwrite data; hosts should confirm with the user. */
|
|
22
|
+
destructiveHint: boolean;
|
|
23
|
+
/** Calling it again with the same arguments has no further effect. */
|
|
24
|
+
idempotentHint: boolean;
|
|
25
|
+
/** The tool reaches systems outside this Critical Path backend. */
|
|
26
|
+
openWorldHint: boolean;
|
|
27
|
+
}
|
|
5
28
|
export interface ToolDefinition<TParams = any, TResult = any> {
|
|
6
29
|
name: string;
|
|
7
30
|
title: string;
|
|
31
|
+
/**
|
|
32
|
+
* What the model reads to choose a tool. Say what question it answers, when to use it, what it
|
|
33
|
+
* returns, and which sibling tool to use instead (in backticks) when the two could be confused.
|
|
34
|
+
*/
|
|
8
35
|
description: string;
|
|
36
|
+
toolset: ToolsetName;
|
|
9
37
|
zodSchema: z.ZodObject<any>;
|
|
10
38
|
/** JSON Schema shown to MCP clients. Generated from `zodSchema` by `defineTool`. */
|
|
11
39
|
inputSchema: Record<string, unknown>;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
40
|
+
/** Shape of the result. Results are always JSON objects so they can be sent as structured content. */
|
|
41
|
+
outputZodSchema: z.ZodTypeAny;
|
|
42
|
+
/** JSON Schema of the result shown to MCP clients. Generated from `outputZodSchema` by `defineTool`. */
|
|
43
|
+
outputSchema: Record<string, unknown>;
|
|
44
|
+
annotations: ToolAnnotations;
|
|
16
45
|
execute: (args: TParams, target: BackendContext, ambientContext?: {
|
|
17
46
|
projectId?: string;
|
|
18
47
|
}) => Promise<TResult>;
|
|
19
48
|
}
|
|
49
|
+
type ToolSpec<TParams, TResult> = Omit<ToolDefinition<TParams, TResult>, 'inputSchema' | 'outputSchema' | 'annotations'> & {
|
|
50
|
+
annotations?: Partial<ToolAnnotations>;
|
|
51
|
+
};
|
|
20
52
|
/**
|
|
21
|
-
* Declares a tool, generating its JSON Schema `inputSchema`
|
|
22
|
-
* model sees and the
|
|
53
|
+
* Declares a tool, generating its JSON Schema `inputSchema` and `outputSchema` from the zod schemas
|
|
54
|
+
* so the schemas the model sees and the ones values are checked against cannot drift apart.
|
|
23
55
|
*/
|
|
24
|
-
export declare function defineTool<TParams = any, TResult = any>(spec:
|
|
56
|
+
export declare function defineTool<TParams = any, TResult = any>(spec: ToolSpec<TParams, TResult>): ToolDefinition<TParams, TResult>;
|
|
25
57
|
export declare class ToolArgumentError extends Error {
|
|
26
58
|
constructor(toolName: string, details: string);
|
|
27
59
|
}
|
|
@@ -33,7 +65,9 @@ export declare function parseToolArgs<TParams>(tool: ToolDefinition<TParams>, ar
|
|
|
33
65
|
export declare function resolveBackend(target: BackendContext): Promise<{
|
|
34
66
|
isEngine: boolean;
|
|
35
67
|
}>;
|
|
36
|
-
export declare const listProjectsTool: ToolDefinition<any,
|
|
68
|
+
export declare const listProjectsTool: ToolDefinition<any, {
|
|
69
|
+
projects: import("@critical-path/core").Project[];
|
|
70
|
+
}>;
|
|
37
71
|
export declare const getProjectTool: ToolDefinition<{
|
|
38
72
|
id: string;
|
|
39
73
|
}, any>;
|
|
@@ -57,6 +91,7 @@ export declare const listTasksTool: ToolDefinition<{
|
|
|
57
91
|
}, any>;
|
|
58
92
|
export declare const getTaskTool: ToolDefinition<{
|
|
59
93
|
id: string;
|
|
94
|
+
includeDependencies?: boolean;
|
|
60
95
|
}, any>;
|
|
61
96
|
export declare const createTaskTool: ToolDefinition<{
|
|
62
97
|
projectId?: string;
|
|
@@ -92,6 +127,16 @@ export declare const updateTaskTool: ToolDefinition<{
|
|
|
92
127
|
export declare const deleteTaskTool: ToolDefinition<{
|
|
93
128
|
id: string;
|
|
94
129
|
}, any>;
|
|
130
|
+
export declare const addDependencyTool: ToolDefinition<{
|
|
131
|
+
taskId: string;
|
|
132
|
+
dependsOnTaskId: string;
|
|
133
|
+
type?: "blocking" | "relates_to";
|
|
134
|
+
}, any>;
|
|
135
|
+
export declare const removeDependencyTool: ToolDefinition<{
|
|
136
|
+
taskId: string;
|
|
137
|
+
dependsOnTaskId: string;
|
|
138
|
+
type?: "blocking" | "relates_to";
|
|
139
|
+
}, any>;
|
|
95
140
|
export declare const listDeliverablesTool: ToolDefinition<{
|
|
96
141
|
projectId?: string;
|
|
97
142
|
}, any>;
|
|
@@ -151,6 +196,35 @@ export declare const getWorkloadDistributionTool: ToolDefinition<{
|
|
|
151
196
|
metric?: "scheduled" | "logged" | "remaining" | "blended";
|
|
152
197
|
defaultWeeklyCapacityHours?: number;
|
|
153
198
|
}, any>;
|
|
199
|
+
export declare const getSkillTool: ToolDefinition<{
|
|
200
|
+
name?: string;
|
|
201
|
+
}, any>;
|
|
154
202
|
export declare const ALL_TOOLS: ToolDefinition[];
|
|
155
203
|
export declare const TOOL_MAP: Map<string, ToolDefinition<any, any>>;
|
|
204
|
+
export interface ToolSelection {
|
|
205
|
+
/** Exact tool names to expose. Combined with `toolsets` (a tool in either is exposed). */
|
|
206
|
+
tools?: string[];
|
|
207
|
+
/** Tool groups to expose. Without `tools` or `toolsets`, every tool is exposed. */
|
|
208
|
+
toolsets?: ToolsetName[];
|
|
209
|
+
/** Expose only tools that change nothing. */
|
|
210
|
+
readOnly?: boolean;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Picks the tools a host exposes. Unknown tool or toolset names throw, so a typo cannot silently
|
|
214
|
+
* leave an agent without the tools it was meant to have. `get_skill` follows the same rules as
|
|
215
|
+
* other tools: include the `guidance` toolset (or name it) to keep skills reachable.
|
|
216
|
+
*/
|
|
217
|
+
export declare function selectTools(selection?: ToolSelection): ToolDefinition[];
|
|
218
|
+
export declare class ToolNotFoundError extends Error {
|
|
219
|
+
constructor(message: string);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Validates arguments, runs a tool and returns a JSON-safe object result. A missing record (a
|
|
223
|
+
* `null` result) becomes an error, and errors carry a hint for what to do next so the agent can
|
|
224
|
+
* recover on its own.
|
|
225
|
+
*/
|
|
226
|
+
export declare function runTool(tool: ToolDefinition, args: unknown, target: BackendContext, ambientContext?: {
|
|
227
|
+
projectId?: string;
|
|
228
|
+
}): Promise<Record<string, unknown>>;
|
|
229
|
+
export {};
|
|
156
230
|
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,EAA6C,MAAM,qBAAqB,CAAC;AACzG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAmBhE,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,kBAAkB,CAAC;AAErE;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;CAMX,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,QAAQ,CAAC;AAEhD,qCAAqC;AACrC,MAAM,WAAW,eAAe;IAC9B,yCAAyC;IACzC,YAAY,EAAE,OAAO,CAAC;IACtB,8FAA8F;IAC9F,eAAe,EAAE,OAAO,CAAC;IACzB,sEAAsE;IACtE,cAAc,EAAE,OAAO,CAAC;IACxB,mEAAmE;IACnE,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,cAAc,CAAC,OAAO,GAAG,GAAG,EAAE,OAAO,GAAG,GAAG;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG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