Title: get_file_contents directory results emit a top-level structuredContent array that object-only clients reject · Issue #3864 · github/github-mcp-server · GitHub
Open Graph Title: get_file_contents directory results emit a top-level structuredContent array that object-only clients reject · Issue #3864 · github/github-mcp-server
X Title: get_file_contents directory results emit a top-level structuredContent array that object-only clients reject · Issue #3864 · github/github-mcp-server
Description: GitHub's official MCP Server. Contribute to github/github-mcp-server development by creating an account on GitHub.
Open Graph Description: GitHub's official MCP Server. Contribute to github/github-mcp-server development by creating an account on GitHub.
X Description: GitHub's official MCP Server. Contribute to github/github-mcp-server development by creating an account on GitHub.
Opengraph URL: https://github.com/github/github-mcp-server
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"get_file_contents directory results emit a top-level structuredContent array that object-only clients reject","articleBody":"### Summary\n\n`get_file_contents` works for individual files but fails to list directories in an MCP client that requires `structuredContent` to be an object. The directory path produces a top-level JSON array and advertises that shape in `outputSchema`; the client rejects the response before exposing the entries.\n\n### Reproduction\n\nUsing the GitHub MCP Server connector (reported server version 2.1.0), call `get_file_contents` with `owner: \"github\"`, `repo: \"github-mcp-server\"`, `path: \"/\"`, `fields: [\"name\", \"type\", \"path\"]`. The same failure also occurs for `path: \"pkg/github\"` and `path: \"internal\"`. Reading a single file such as `pkg/github/repository_tool_types.go` succeeds.\n\nThe directory call fails with:\n\n```\nUpstream call failed on target 'remote': 1 validation error for CallToolResult\nstructuredContent\n Input should be a valid dictionary [type=dict_type, input_value=[{'name': '.dockerignore'...}], input_type=list]\n```\n\n### Evidence in the repository\n\n- [`RepositoryContentsOutput.MarshalJSON`](https://github.com/github/github-mcp-server/blob/0663b830582af923e30fb14cb2e10dd3248baa86/pkg/github/repository_tool_types.go) calls `json.Marshal(out.Directory)` for directory results, so the structured output is an array at its root.\n- `repositoryContentsOutputSchema()` in the same file explicitly includes an `array` variant, reflected by the [`get_file_contents` tool snapshot](https://github.com/github/github-mcp-server/blob/0663b830582af923e30fb14cb2e10dd3248baa86/pkg/github/__toolsnaps__/get_file_contents.snap) (`outputSchema.oneOf`: null, array, object).\n\nThis is a specific interoperability failure, distinct from the general request in #1929 to populate `structuredContent` for tools.\n\n### Expected behavior / suggested fix\n\nDirectory listings should remain usable by clients that expect an object-valued `structuredContent`. Wrap the entries in an object, e.g. `{ \"entries\": [...] }`, and update the advertised output schema and tests accordingly. Preserve the existing text output for compatibility, and add a regression test that exercises a directory listing through an object-valued structured-content consumer.\n\n### Impact\n\nAgents using such clients cannot browse repository directories through `get_file_contents`, even when file reads and code search work.","author":{"url":"https://github.com/apps/self-gh-mcp-poc","@type":"Person","name":"self-gh-mcp-poc"},"datePublished":"2026-11-16T10:40:15Z","url":"https://github.com/github/github-mcp-server/issues/3864"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:ade01a3f-fd27-7836-c47b-52c41843a7eb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E7D8:3422CF:29CB1C:36C2FB:6B061502 |
| html-safe-nonce | ab3168572a4a7a2ca5f80e914e81a6c904ba6f18967edf0d1a34d51ebf680808 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFN0Q4OjM0MjJDRjoyOUNCMUM6MzZDMkZCOjZCMDYxNTAyIiwidmlzaXRvcl9pZCI6IjYxMjQxNDg4MjM1NDQ5NjAyNTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2e8b39a2301d7abefb65660cc419657998dc306de9e8f2245562f4b50c05da8e |
| hovercard-subject-tag | repository:942771284 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/github/github-mcp-server/issues/3864 |
| twitter:image | https://opengraph.githubassets.com/d996c822b8a08a1d7a875471dafc43c527ecf820b3f066371212740244f78785/github/github-mcp-server |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d996c822b8a08a1d7a875471dafc43c527ecf820b3f066371212740244f78785/github/github-mcp-server |
| og:image:alt | GitHub's official MCP Server. Contribute to github/github-mcp-server development by creating an account on GitHub. |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 97d4714e567728e1f85f88b0cf68c89f0f8a3dc41e8869af7aeb8195ad990374 |
| turbo-cache-control | no-cache |
| go-import | github.com/github/github-mcp-server git https://github.com/github/github-mcp-server.git |
| octolytics-dimension-user_id | 9919 |
| octolytics-dimension-user_login | github |
| octolytics-dimension-repository_id | 942771284 |
| octolytics-dimension-repository_nwo | github/github-mcp-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 942771284 |
| octolytics-dimension-repository_network_root_nwo | github/github-mcp-server |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 866f202ebf7ac5aff8f633417d9fd8a53818a977 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width