pi-mcp-client 0.3.3 → 0.5.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/README.md +33 -364
- package/dist/index.js +2216 -1091
- package/docs/authentication.md +175 -0
- package/docs/behavior.md +114 -0
- package/docs/commands.md +171 -0
- package/docs/configuration.md +150 -0
- package/docs/tool-reference.md +147 -0
- package/docs/troubleshooting.md +67 -0
- package/package.json +2 -1
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Assistant tool reference
|
|
2
|
+
|
|
3
|
+
[Back to the README](../README.md)
|
|
4
|
+
|
|
5
|
+
This page documents **the assistant's interface**. The examples illustrate tool
|
|
6
|
+
calls the assistant makes; they aren't slash commands or JavaScript for you to
|
|
7
|
+
run. Describe your task in natural language. For operations you control directly,
|
|
8
|
+
see [Commands](commands.md).
|
|
9
|
+
|
|
10
|
+
The `mcp_tools` tool supports four mutually exclusive operations:
|
|
11
|
+
|
|
12
|
+
| Operation | What the assistant can do | What it doesn't do |
|
|
13
|
+
| --- | --- | --- |
|
|
14
|
+
| `query` | Discover tool and resource metadata. | Read content or activate tools. |
|
|
15
|
+
| `activate` | Load full schemas for exact tool identifiers. | Invoke tools. |
|
|
16
|
+
| `read` | Fetch one resource as conversation context. | Activate tools or follow links automatically. |
|
|
17
|
+
| `complete` | Request server suggestions for a template variable. | Read resources, activate tools, or select a value. |
|
|
18
|
+
|
|
19
|
+
The assistant passes exactly one of `query`, `activate`, `read`, or `complete`.
|
|
20
|
+
The optional `kind`, `server`, and `limit` fields are query-only; reads and
|
|
21
|
+
completions carry their server inside their respective objects.
|
|
22
|
+
|
|
23
|
+
## Discover capabilities
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
// Search tool and resource metadata on one server.
|
|
27
|
+
mcp_tools({ query: "database schema", server: "warehouse", limit: 5 })
|
|
28
|
+
|
|
29
|
+
// Restrict one search to tools.
|
|
30
|
+
mcp_tools({ query: "list teams", server: "linear", kind: "tools" })
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`kind` defaults to `all`, or accepts `tools` and `resources`. Discovery returns up
|
|
34
|
+
to five candidates by default, or up to 50 with `limit`, across both kinds.
|
|
35
|
+
|
|
36
|
+
Tool candidates show an exact activation identifier, a short description,
|
|
37
|
+
required parameter names only, and `[loaded]` if already active. Resource
|
|
38
|
+
candidates show the owning server, title or name, exact URI, description, and
|
|
39
|
+
content type when supplied. Concrete resources and tools include exact next-call
|
|
40
|
+
arguments; templates include a read-call shape and variable names.
|
|
41
|
+
|
|
42
|
+
Search uses local BM25-based ranking of metadata, with names and resource titles
|
|
43
|
+
weighted more strongly than descriptions, and support for prefix matching.
|
|
44
|
+
Resource content isn't fetched or searched. See
|
|
45
|
+
[discovery and caching](behavior.md#discovery-and-caching) for connection behavior.
|
|
46
|
+
|
|
47
|
+
## Activate and call tools
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
mcp_tools({ activate: ["linear.list_teams", "linear.get_team"] })
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Activation accepts 1–50 exact `server.tool` or `mcp__server__tool` identifiers,
|
|
54
|
+
ignores duplicates, and works without a prior search. Typos never activate fuzzy
|
|
55
|
+
matches: failures list nearby catalog names when available so the assistant can
|
|
56
|
+
retry with an exact identifier. Each identifier reports `loaded`, `already loaded`,
|
|
57
|
+
or `not loaded` with a reason. Partial success keeps the tools that loaded.
|
|
58
|
+
|
|
59
|
+
Full schemas become available on the model turn after activation. When discovery
|
|
60
|
+
is needed, first use follows three steps: discover, activate, then call the native
|
|
61
|
+
tool. There is no invocation proxy. Previously loaded tools remain available;
|
|
62
|
+
[session behavior](behavior.md#sessions) describes restoration and tool restrictions.
|
|
63
|
+
|
|
64
|
+
## Read resources as context
|
|
65
|
+
|
|
66
|
+
For a request such as “Use the authentication guide to explain this API,” the
|
|
67
|
+
assistant can discover and read relevant context:
|
|
68
|
+
|
|
69
|
+
```js
|
|
70
|
+
mcp_tools({ query: "authentication guide", kind: "resources" })
|
|
71
|
+
mcp_tools({ read: { server: "docs", uri: "docs://authentication" } })
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
A read fetches one exact resource URI through its configured server's MCP
|
|
75
|
+
`resources/read` operation. It doesn't open a local file or make a generic HTTP
|
|
76
|
+
request, even for `file:` or `https:` URIs. There is no fallback when the server
|
|
77
|
+
can't read the URI. The server still controls which data it returns.
|
|
78
|
+
|
|
79
|
+
Tool-returned resource links include an exact `mcp_tools({read: ...})` call. The
|
|
80
|
+
assistant can read such links directly, without prior discovery or activation;
|
|
81
|
+
linked resources don't have to appear in the catalog.
|
|
82
|
+
|
|
83
|
+
Reading attaches content as the tool result itself, not as a second message. The
|
|
84
|
+
result identifies the source server and URIs and labels the content as untrusted
|
|
85
|
+
data. See [resource snapshots](behavior.md#resource-snapshots) for freshness and
|
|
86
|
+
session privacy, and [large results](troubleshooting.md#large-results) for output
|
|
87
|
+
limits and private spill files.
|
|
88
|
+
|
|
89
|
+
## Read parameterized resources
|
|
90
|
+
|
|
91
|
+
Discovery also lists URI templates, such as `schema://tables/{table}`, without
|
|
92
|
+
enumerating every possible table. Templates have a `[template]` label, variable
|
|
93
|
+
names, and a read-call shape. The assistant supplies known argument values:
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
mcp_tools({ query: "table schema", server: "warehouse", kind: "resources" })
|
|
97
|
+
mcp_tools({
|
|
98
|
+
read: {
|
|
99
|
+
server: "warehouse",
|
|
100
|
+
template: "schema://tables/{table}",
|
|
101
|
+
arguments: { table: "events" }
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The `read` object accepts either `uri` or `template` plus `arguments`, never both.
|
|
107
|
+
The selected server must advertise the exact template. The official SDK expands
|
|
108
|
+
strings or string arrays into a concrete URI, then reads it through that same
|
|
109
|
+
server. Template variables aren't an input schema: no required fields or allowed
|
|
110
|
+
values are inferred. The assistant should use values from your request or prior
|
|
111
|
+
results and ask you when a needed value is unknown rather than inventing an
|
|
112
|
+
identifier.
|
|
113
|
+
|
|
114
|
+
Argument data is limited to 64 KiB and expanded URIs to 4,096 characters. Template
|
|
115
|
+
reads share exact reads' authorization, cancellation, output limits, and snapshot
|
|
116
|
+
rules. Expanded output includes the template, supplied arguments, and resource
|
|
117
|
+
content; see [result display](behavior.md#result-display).
|
|
118
|
+
|
|
119
|
+
## Complete resource arguments
|
|
120
|
+
|
|
121
|
+
The assistant can ask a server for suggested values for one advertised template
|
|
122
|
+
variable:
|
|
123
|
+
|
|
124
|
+
```js
|
|
125
|
+
mcp_tools({
|
|
126
|
+
complete: {
|
|
127
|
+
server: "warehouse",
|
|
128
|
+
template: "schema://tables/{table}",
|
|
129
|
+
argument: { name: "table", value: "ev" }
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
`value` is the current prefix and can be empty. For dependent suggestions, the
|
|
135
|
+
assistant can add `arguments: { knownVariable: "value" }` inside `complete`.
|
|
136
|
+
These context values must be strings, not arrays. The server must advertise
|
|
137
|
+
completion support and the exact template; the variable must occur in that
|
|
138
|
+
template.
|
|
139
|
+
|
|
140
|
+
The result contains `values` and, when supplied by the server, `total` and
|
|
141
|
+
`hasMore`. A narrower prefix can reduce the matches. Suggestions are untrusted
|
|
142
|
+
server data, not a required-field schema or instructions. Requests are limited
|
|
143
|
+
to 64 KiB; output uses the same [limits and spill files](troubleshooting.md#large-results)
|
|
144
|
+
as other results.
|
|
145
|
+
|
|
146
|
+
Resource subscriptions aren't part of this tool. Only you can
|
|
147
|
+
[watch resource changes](commands.md#watch-resource-changes) with `/mcp` commands.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
[Back to the README](../README.md)
|
|
4
|
+
|
|
5
|
+
Start with `/mcp` to inspect server status and `/mcp get <server>` to inspect
|
|
6
|
+
configuration without connecting. Failures use a consistent code, a short
|
|
7
|
+
explanation, and a recovery hint, for example:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
linear: [authentication_required] Authentication is required. Run /mcp login linear.
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Diagnostic codes
|
|
14
|
+
|
|
15
|
+
Search and tool results also carry structured diagnostics in their result details:
|
|
16
|
+
`code`, `operation`, optional `server`, `message`, and `hint`. Partial discovery
|
|
17
|
+
keeps healthy servers' results and identifies servers it couldn't search. An
|
|
18
|
+
unavailable server isn't an empty catalog.
|
|
19
|
+
|
|
20
|
+
| Code | What to check |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| `configuration_invalid` | JSON syntax, supported fields, transport type, and required environment variables. Run `/mcp reload` after editing. |
|
|
23
|
+
| `authentication_required` | Run `/mcp login <server>` for OAuth, or check the Authorization header. |
|
|
24
|
+
| `permission_denied` | Account permissions, OAuth scopes, and service access policy. |
|
|
25
|
+
| `credential_store_unavailable` | Unlock or enable the OS keyring; Linux needs a Secret Service session. |
|
|
26
|
+
| `secret_lookup_failed` | Secret helper installation, login, exit status, nonempty stdout, and output size. |
|
|
27
|
+
| `connection_failed` | Server executable, working directory, endpoint, network, and TLS configuration. |
|
|
28
|
+
| `timeout` | Server responsiveness and the applicable request, secret-command, or OAuth time limit. |
|
|
29
|
+
| `protocol_error` | Server compatibility and the `protocol` setting. |
|
|
30
|
+
| `tool_changed` | Check server filters and ask the assistant to activate the exact tool again for its current schema. Run `/mcp reload` if connection configuration changed. |
|
|
31
|
+
| `tool_error` | The server's tool result and inputs; verify the outcome before retrying. |
|
|
32
|
+
| `resource_invalid` | The assistant needs an exact absolute resource URI from discovery or a tool-returned link. |
|
|
33
|
+
| `resource_not_found` | Refresh resource metadata or obtain a new link. |
|
|
34
|
+
| `resources_unsupported` | Ask the assistant to use the server's tools instead, or choose a resource-capable server. |
|
|
35
|
+
| `completions_unsupported` | Supply known template values; the assistant should ask you if a value is missing. |
|
|
36
|
+
| `completion_invalid` | The assistant needs an advertised template variable and a string prefix. |
|
|
37
|
+
| `subscriptions_unsupported` | Choose a server with subscription support, or ask the assistant to read when needed. |
|
|
38
|
+
| `subscription_limit` | Remove a watch before adding another; the limit is 50 per connection. |
|
|
39
|
+
| `catalog_changed` | Ask the assistant to retry discovery after the server catalog settles. |
|
|
40
|
+
| `oauth_failed` | Browser access to the callback and support for public clients, using dynamic registration or the configured client ID. |
|
|
41
|
+
| `oauth_issuer_changed` | Verify the authorization-server change before logging out and logging in again. |
|
|
42
|
+
| `callback_unavailable` | Another process using the configured loopback port (default 19847). Change `oauthCallbackPort` or use `/mcp login <server> --no-browser`. |
|
|
43
|
+
| `busy` | Wait for discovery to finish before reconnecting. |
|
|
44
|
+
| `cancelled` | Retry when ready; verify any interrupted tool operation first. |
|
|
45
|
+
| `operation_failed` | An unclassified failure; inspect server status and configuration. |
|
|
46
|
+
|
|
47
|
+
For setup details, see [Configuration](configuration.md),
|
|
48
|
+
[Authentication](authentication.md), and [Commands](commands.md).
|
|
49
|
+
|
|
50
|
+
Diagnostics never echo raw exception messages, HTTP bodies, command stderr,
|
|
51
|
+
credential values, or stack traces. Unknown errors stay generic rather than being
|
|
52
|
+
classified by potentially sensitive message text. Server-provided tool results
|
|
53
|
+
remain visible as content, even when the tool reports an error; they aren't
|
|
54
|
+
sanitized transport diagnostics. Tool-call failures aren't replayed automatically;
|
|
55
|
+
verify the outcome before retrying.
|
|
56
|
+
|
|
57
|
+
## Large results
|
|
58
|
+
|
|
59
|
+
Text output is limited to 2,000 lines or 50 KiB, including resource reads and
|
|
60
|
+
completions. Larger results are saved in private temporary files, with paths
|
|
61
|
+
included in the output. Full tool results use JSON files. Supported images pass
|
|
62
|
+
through within an 8 MiB base64 budget; unsupported or oversized binary content is
|
|
63
|
+
retained in the full result file.
|
|
64
|
+
|
|
65
|
+
A resource read fetches the server's full response before applying output limits;
|
|
66
|
+
it isn't a streaming or partial-content reader. Temporary result files aren't
|
|
67
|
+
automatically deleted and may contain sensitive data.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-mcp-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "MCP tools for Pi, discovered on demand and called natively through the official SDK.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"dist",
|
|
23
|
+
"docs",
|
|
23
24
|
"README.md",
|
|
24
25
|
"LICENSE"
|
|
25
26
|
],
|