nf1qaz2w on Discord: "mcp现在好像只能看到有几个工具,看不到具体的工具名和描述等, 能否支持下?" The Library's MCP check kept only len(tools) from tools/list. What changed: - internal/library/mcp_check.go: ServerHealth carries ToolList (json "toolList"): each tool's name and the first paragraph of its description, whitespace collapsed and cut at 500 runes (a tool with only a title gets the title); names cut at 128; at most 500 tools kept while Tools still counts all. tools/list is now asked through listTools, shared by the stdio, streamable HTTP and SSE checks: it follows nextCursor up to 10 pages, each page with a step budget of its own (the #1467 per-step timeout), and a page after the first that is refused ends the list there. Before, nextCursor was ignored and only the first page counted. - internal/gui/assets/library.js/.css: a server whose check listed tools shows a chevron on its "N tools" status; a click opens the list under the row (name in the code font, description under it, "N more not shown" when magpie kept fewer than the server has, and Check again). Clicking the count again shuts it. A server with no listed tools keeps the old click, which checks it again. The list stays while it is checked again, no editor opens, no left-border stripe, no native select. The click guard keeps the clicked status in place (a centred row gives up 1px as it grows). - i18n: "Click to see them", "Click to hide them", "{n} more not shown" in zh, zh-TW, ja, de. - docs/subsystems/library.md: the check's tool list and paging. There is no CLI/TUI output of a server's check, so nothing changed there. What was run: - go test ./internal/library: TestCheckKeepsToolNames runs the check on the tools/list reply @modelcontextprotocol/server-filesystem really gave (captured with npx, testdata/filesystem-tools-list.json, 14 tools, the longest description 457 chars); TestCheckToolPages (no description, title only, a 1000-char description cut, two pages by nextCursor, the JSON the page reads); TestCheckToolPagesEnd (a server that pages forever is asked 10 times). With the list not kept and paging off, the first two fail: "got {State:ok Tools:14 ToolList:[] ...}, want ok with 14 tools, each listed" and "...Tools:3 ToolList:[]..., want ok with 4 tools over 2 pages". - GUI: internal/gui/tests/library-mcp-tools.test.cjs, Chromium and WebKit, en/zh/zh-TW/ja/de, at 980 and 420 wide: 20/20 pass; against the old library.js it fails. library-*.test.cjs, mcp-signin, search-mcp, i18n-keys and click-scroll in both engines: 377/377 pass. - gofmt -l (nothing), go vet / GOOS=linux / GOOS=windows go vet -tags nogui on internal/library and internal/gui, go build for darwin, linux and windows (nogui). Full go test -tags nogui ./... under the queue lock: every package ok but internal/provider, where TestClaudeSavedAccountDir failed "sign-in never finished" (waitDone's 2s bound on a fake claude process under full-suite load); alone it passes 5/5. Not touched here.
2 lines
13 KiB
JSON
2 lines
13 KiB
JSON
{"result":{"tools":[{"name":"read_file","title":"Read File (Deprecated)","description":"Read the complete contents of a file as text. DEPRECATED: Use read_text_file instead.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"path":{"type":"string"},"tail":{"description":"If provided, returns only the last N lines of the file","type":"number"},"head":{"description":"If provided, returns only the first N lines of the file","type":"number"}},"required":["path"]},"annotations":{"readOnlyHint":true,"openWorldHint":false},"execution":{"taskSupport":"forbidden"},"outputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"content":{"type":"string"}},"required":["content"],"additionalProperties":false}},{"name":"read_text_file","title":"Read Text File","description":"Read the complete contents of a file from the file system as text. Handles various text encodings and provides detailed error messages if the file cannot be read. Use this tool when you need to examine the contents of a single file. Use the 'head' parameter to read only the first N lines of a file, or the 'tail' parameter to read only the last N lines of a file. Operates on the file as text regardless of extension. Only works within allowed directories.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"path":{"type":"string"},"tail":{"description":"If provided, returns only the last N lines of the file","type":"number"},"head":{"description":"If provided, returns only the first N lines of the file","type":"number"}},"required":["path"]},"annotations":{"readOnlyHint":true,"openWorldHint":false},"execution":{"taskSupport":"forbidden"},"outputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"content":{"type":"string"}},"required":["content"],"additionalProperties":false}},{"name":"read_media_file","title":"Read Media File","description":"Read a file and return it as a base64-encoded content block with its MIME type. Image and audio files are returned as image/audio content; any other file type is returned as an embedded resource. Only works within allowed directories.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"path":{"type":"string"}},"required":["path"]},"annotations":{"readOnlyHint":true,"openWorldHint":false},"execution":{"taskSupport":"forbidden"},"outputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"content":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["image","audio"]},"data":{"type":"string"},"mimeType":{"type":"string"}},"required":["type","data","mimeType"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"resource"},"resource":{"type":"object","properties":{"uri":{"type":"string"},"mimeType":{"type":"string"},"blob":{"type":"string"}},"required":["uri","blob"],"additionalProperties":false}},"required":["type","resource"],"additionalProperties":false}]}}},"required":["content"],"additionalProperties":false}},{"name":"read_multiple_files","title":"Read Multiple Files","description":"Read the contents of multiple files simultaneously. This is more efficient than reading files one by one when you need to analyze or compare multiple files. Each file's content is returned with its path as a reference. Failed reads for individual files won't stop the entire operation. Only works within allowed directories.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"paths":{"minItems":1,"type":"array","items":{"type":"string"},"description":"Array of file paths to read. Each path must be a string pointing to a valid file within allowed directories."}},"required":["paths"]},"annotations":{"readOnlyHint":true,"openWorldHint":false},"execution":{"taskSupport":"forbidden"},"outputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"content":{"type":"string"}},"required":["content"],"additionalProperties":false}},{"name":"write_file","title":"Write File","description":"Create a new file or completely overwrite an existing file with new content. Use with caution as it will overwrite existing files without warning. Handles text content with proper encoding. Only works within allowed directories.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"path":{"type":"string"},"content":{"type":"string"}},"required":["path","content"]},"annotations":{"readOnlyHint":false,"idempotentHint":true,"destructiveHint":true,"openWorldHint":false},"execution":{"taskSupport":"forbidden"},"outputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"content":{"type":"string"}},"required":["content"],"additionalProperties":false}},{"name":"edit_file","title":"Edit File","description":"Make line-based edits to a text file. Each edit replaces exact line sequences with new content. Returns a git-style diff showing the changes made. Only works within allowed directories.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"path":{"type":"string"},"edits":{"type":"array","items":{"type":"object","properties":{"oldText":{"type":"string","description":"Text to search for - must match exactly"},"newText":{"type":"string","description":"Text to replace with"}},"required":["oldText","newText"]}},"dryRun":{"default":false,"description":"Preview changes using git-style diff format","type":"boolean"}},"required":["path","edits"]},"annotations":{"readOnlyHint":false,"idempotentHint":false,"destructiveHint":true,"openWorldHint":false},"execution":{"taskSupport":"forbidden"},"outputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"content":{"type":"string"}},"required":["content"],"additionalProperties":false}},{"name":"create_directory","title":"Create Directory","description":"Create a new directory or ensure a directory exists. Can create multiple nested directories in one operation. If the directory already exists, this operation will succeed silently. Perfect for setting up directory structures for projects or ensuring required paths exist. Only works within allowed directories.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"path":{"type":"string"}},"required":["path"]},"annotations":{"readOnlyHint":false,"idempotentHint":true,"destructiveHint":false,"openWorldHint":false},"execution":{"taskSupport":"forbidden"},"outputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"content":{"type":"string"}},"required":["content"],"additionalProperties":false}},{"name":"list_directory","title":"List Directory","description":"Get a detailed listing of all files and directories in a specified path. Results clearly distinguish between files and directories with [FILE] and [DIR] prefixes. This tool is essential for understanding directory structure and finding specific files within a directory. Only works within allowed directories.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"path":{"type":"string"}},"required":["path"]},"annotations":{"readOnlyHint":true,"openWorldHint":false},"execution":{"taskSupport":"forbidden"},"outputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"content":{"type":"string"}},"required":["content"],"additionalProperties":false}},{"name":"list_directory_with_sizes","title":"List Directory with Sizes","description":"Get a detailed listing of all files and directories in a specified path, including sizes. Results clearly distinguish between files and directories with [FILE] and [DIR] prefixes. This tool is useful for understanding directory structure and finding specific files within a directory. Only works within allowed directories.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"path":{"type":"string"},"sortBy":{"default":"name","description":"Sort entries by name or size","type":"string","enum":["name","size"]}},"required":["path"]},"annotations":{"readOnlyHint":true,"openWorldHint":false},"execution":{"taskSupport":"forbidden"},"outputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"content":{"type":"string"}},"required":["content"],"additionalProperties":false}},{"name":"directory_tree","title":"Directory Tree","description":"Get a recursive tree view of files and directories as a JSON structure. Each entry includes 'name', 'type' (file/directory), and 'children' for directories. Files have no children array, while directories always have a children array (which may be empty). The output is formatted with 2-space indentation for readability. Only works within allowed directories.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"path":{"type":"string"},"excludePatterns":{"default":[],"type":"array","items":{"type":"string"}}},"required":["path"]},"annotations":{"readOnlyHint":true,"openWorldHint":false},"execution":{"taskSupport":"forbidden"},"outputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"content":{"type":"string"}},"required":["content"],"additionalProperties":false}},{"name":"move_file","title":"Move File","description":"Move or rename files and directories. Can move files between directories and rename them in a single operation. If the destination exists, the operation will fail. Works across different directories and can be used for simple renaming within the same directory. Both source and destination must be within allowed directories.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"source":{"type":"string"},"destination":{"type":"string"}},"required":["source","destination"]},"annotations":{"readOnlyHint":false,"idempotentHint":false,"destructiveHint":true,"openWorldHint":false},"execution":{"taskSupport":"forbidden"},"outputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"content":{"type":"string"}},"required":["content"],"additionalProperties":false}},{"name":"search_files","title":"Search Files","description":"Recursively search for files and directories matching a pattern. The patterns should be glob-style patterns that match paths relative to the working directory. Use pattern like '*.ext' to match files in current directory, and '**/*.ext' to match files in all subdirectories. Returns full paths to all matching items. Great for finding files when you don't know their exact location. Only searches within allowed directories.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"path":{"type":"string"},"pattern":{"type":"string"},"excludePatterns":{"default":[],"type":"array","items":{"type":"string"}}},"required":["path","pattern"]},"annotations":{"readOnlyHint":true,"openWorldHint":false},"execution":{"taskSupport":"forbidden"},"outputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"content":{"type":"string"}},"required":["content"],"additionalProperties":false}},{"name":"get_file_info","title":"Get File Info","description":"Retrieve detailed metadata about a file or directory. Returns comprehensive information including size, creation time, last modified time, permissions, and type. This tool is perfect for understanding file characteristics without reading the actual content. Only works within allowed directories.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"path":{"type":"string"}},"required":["path"]},"annotations":{"readOnlyHint":true,"openWorldHint":false},"execution":{"taskSupport":"forbidden"},"outputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"content":{"type":"string"}},"required":["content"],"additionalProperties":false}},{"name":"list_allowed_directories","title":"List Allowed Directories","description":"Returns the list of directories that this server is allowed to access. Subdirectories within these allowed directories are also accessible. Use this to understand which directories and their nested paths are available before trying to access files.","inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{}},"annotations":{"readOnlyHint":true,"openWorldHint":false},"execution":{"taskSupport":"forbidden"},"outputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"content":{"type":"string"}},"required":["content"],"additionalProperties":false}}]},"jsonrpc":"2.0","id":2}
|