-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagent-api.json
More file actions
292 lines (292 loc) · 11.4 KB
/
Copy pathagent-api.json
File metadata and controls
292 lines (292 loc) · 11.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Facet MCP API",
"version": "0.1.7",
"description": "JSON schemas and example responses for Facet MCP tools. Used by agents for auto-discovery.",
"tools": [
{
"name": "facet_plan_surface",
"description": "Select tools for the current task under a token budget. Returns selected tools (with distilled schemas), deferred tools, before/after token counts, savings percentage, and per-tool routing reasons. Call this before each subtask instead of loading all tool schemas.",
"inputSchema": {
"type": "object",
"properties": {
"task": {
"type": "string",
"description": "What the agent is trying to accomplish. Use verb + target for best results. Example: 'fix login validation bug in auth middleware'."
},
"tools": {
"type": "array",
"description": "Tool definitions to route. Omit if manifest was already registered via facet_register_manifest.",
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"description": { "type": "string" },
"inputSchema": { "type": "object" }
},
"required": ["name"]
}
},
"budget": {
"type": "number",
"description": "Token budget for selected tools. Default: 6000. Increase to 10000 for multi-domain tasks.",
"default": 6000,
"minimum": 500,
"maximum": 50000
},
"profile": {
"type": "string",
"description": "Named profile from facet.json (e.g. 'coding', 'review'). Profiles add preferred clusters and budget overrides."
},
"manifestId": {
"type": "string",
"description": "Cached manifest id from facet_register_manifest. Omit tools when set."
}
},
"required": ["task"]
},
"outputSchema": {
"type": "object",
"properties": {
"task": { "type": "string" },
"selected": {
"type": "array",
"description": "Tools to use for this subtask (distilled schemas, fits within budget)",
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"description": { "type": "string" },
"inputSchema": { "type": "object" }
}
}
},
"deferred": {
"type": "array",
"description": "Tools held back to save tokens — re-plan with a different task to surface them",
"items": {
"type": "object",
"properties": {
"name": { "type": "string" }
}
}
},
"tokensBefore": { "type": "integer", "description": "Total token cost of all tools before routing" },
"tokensAfter": { "type": "integer", "description": "Total token cost of selected tools after routing" },
"savingsPercent": { "type": "number", "description": "Percentage reduction in token cost (0–100)" },
"reasons": {
"type": "object",
"description": "Per-tool routing decision — score and cluster for selected, reason for deferral",
"additionalProperties": { "type": "string" }
}
}
},
"examples": [
{
"input": { "task": "fix the login validation bug", "budget": 4000 },
"output": {
"task": "fix the login validation bug",
"selected": [
{
"name": "mcp__filesystem__read_file",
"description": "Read the complete contents of a file...",
"inputSchema": { "type": "object", "properties": { "path": { "type": "string" } } }
},
{
"name": "mcp__filesystem__grep",
"description": "Search file contents using regular expressions...",
"inputSchema": { "type": "object", "properties": { "pattern": { "type": "string" } } }
},
{
"name": "mcp__shell__run",
"description": "Execute an arbitrary shell command...",
"inputSchema": { "type": "object", "properties": { "command": { "type": "string" } } }
},
{
"name": "mcp__git__diff",
"description": "Show changes between working tree and index...",
"inputSchema": { "type": "object", "properties": {} }
},
{
"name": "mcp__git__status",
"description": "Show working tree status...",
"inputSchema": { "type": "object", "properties": {} }
}
],
"deferred": [
{ "name": "mcp__notion__search" },
{ "name": "mcp__slack__post_message" },
{ "name": "mcp__stripe__create_payment_intent" },
{ "name": "mcp__datadog__query_metrics" }
],
"tokensBefore": 8412,
"tokensAfter": 1240,
"savingsPercent": 85.3,
"reasons": {
"mcp__filesystem__read_file": "score=0.85 cluster=filesystem",
"mcp__filesystem__grep": "score=0.72 cluster=filesystem",
"mcp__shell__run": "score=0.61 cluster=runtime",
"mcp__git__diff": "score=0.54 cluster=git",
"mcp__git__status": "score=0.48 cluster=git",
"mcp__notion__search": "deferred: budget (350 tok)",
"mcp__slack__post_message": "deferred: budget (290 tok)",
"mcp__stripe__create_payment_intent": "deferred: budget (480 tok)"
}
}
},
{
"input": { "task": "search notion for onboarding documentation", "budget": 4000 },
"output": {
"task": "search notion for onboarding documentation",
"selected": [
{ "name": "mcp__notion__search" },
{ "name": "mcp__notion__get_page" },
{ "name": "mcp__filesystem__read_file" },
{ "name": "mcp__github__list_issues" }
],
"deferred": [
{ "name": "mcp__shell__run" },
{ "name": "mcp__git__diff" },
{ "name": "mcp__stripe__create_payment_intent" }
],
"tokensBefore": 8412,
"tokensAfter": 1360,
"savingsPercent": 83.8,
"reasons": {
"mcp__notion__search": "score=0.91 cluster=notion",
"mcp__notion__get_page": "score=0.77 cluster=notion",
"mcp__filesystem__read_file": "score=0.42 cluster=filesystem",
"mcp__github__list_issues": "score=0.21 cluster=github",
"mcp__shell__run": "deferred: budget (310 tok)",
"mcp__git__diff": "deferred: budget (220 tok)"
}
}
}
]
},
{
"name": "facet_audit_tools",
"description": "Measure token cost and capability clusters for a tool manifest. Use at session start to understand your baseline overhead before calling facet_plan_surface.",
"inputSchema": {
"type": "object",
"properties": {
"tools": {
"type": "array",
"description": "Tool definitions to audit",
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"description": { "type": "string" },
"inputSchema": { "type": "object" }
},
"required": ["name"]
}
}
},
"required": ["tools"]
},
"outputSchema": {
"type": "object",
"properties": {
"totalTools": { "type": "integer" },
"totalTokens": { "type": "integer" },
"entries": {
"type": "array",
"items": {
"type": "object",
"properties": {
"tool": { "type": "object" },
"tokens": { "type": "integer" },
"cluster": { "type": "string" }
}
}
},
"clusters": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": { "type": "string" },
"label": { "type": "string" },
"toolCount": { "type": "integer" },
"tokens": { "type": "integer" }
}
}
}
}
},
"examples": [
{
"input": { "tools": [{ "name": "mcp__filesystem__read_file" }, { "name": "mcp__git__diff" }] },
"output": {
"totalTools": 2,
"totalTokens": 540,
"entries": [
{ "tool": { "name": "mcp__filesystem__read_file" }, "tokens": 320, "cluster": "filesystem" },
{ "tool": { "name": "mcp__git__diff" }, "tokens": 220, "cluster": "git" }
],
"clusters": [
{ "id": "filesystem", "label": "filesystem", "toolCount": 1, "tokens": 320 },
{ "id": "git", "label": "git", "toolCount": 1, "tokens": 220 }
]
}
}
]
},
{
"name": "facet_register_manifest",
"description": "Cache the full tool manifest server-side so facet_plan_surface can re-plan cheaply across subtasks without re-sending the full tool list each time. Call once at session start.",
"inputSchema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Optional manifest id (default: auto-generated)"
},
"tools": {
"type": "array",
"description": "Full tool manifest to cache",
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"description": { "type": "string" },
"inputSchema": { "type": "object" }
},
"required": ["name"]
}
}
},
"required": ["tools"]
},
"outputSchema": {
"type": "object",
"properties": {
"manifestId": { "type": "string", "description": "Id to pass to facet_plan_surface and facet_audit_tools" },
"registered": { "type": "integer", "description": "Number of tools cached" },
"totalTokens": { "type": "integer", "description": "Total token cost of the cached manifest" }
}
},
"examples": [
{
"input": { "tools": [{ "name": "mcp__filesystem__read_file" }, { "name": "mcp__git__diff" }] },
"output": { "manifestId": "m1", "registered": 2, "totalTokens": 540 }
}
]
}
],
"mcpConfig": {
"command": "npx",
"args": ["-y", "@kioie/facet", "mcp"]
},
"agentWorkflow": {
"steps": [
"1. Call facet_register_manifest(tools) — once, at session start",
"2. Call facet_plan_surface(task, budget=6000) — before each subtask",
"3. Use ONLY the tools in selected[] for this subtask",
"4. Task changes? Call facet_plan_surface again with the new task string."
],
"note": "Always re-plan when the task domain shifts (e.g. coding → documentation → ops). Routing is cheap; re-plan liberally."
}
}