{"openapi":"3.1.0","info":{"title":"Sourcegraph (BYOK) API","version":"0.1.0","description":"Sourcegraph (BYOK) lets an AI assistant read your own Sourcegraph data through the Sourcegraph API with a key you supply (Sourcegraph access token). Read-only: 8 tools (get_current_user, search_code, list_repositories, get_repository, list_commits, list_directory, read_file, list_branches). The BYOK key travels with each request, is used for that one call only and is never stored, logged or...\n\nEvery operation is read-only or compute-only. The same tools are available over MCP (streamable HTTP) at https://byok-sourcegraph.connectorbay.com/mcp.","contact":{"name":"Unify Dynamics LLC","email":"agent@connectorbay.com","url":"https://connectorbay.com/byok-sourcegraph/docs"},"termsOfService":"https://connectorbay.com/byok-sourcegraph/terms"},"servers":[{"url":"https://byok-sourcegraph.connectorbay.com"}],"externalDocs":{"url":"https://connectorbay.com/byok-sourcegraph/docs"},"security":[{"upstreamKey":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"Optional. A Pro API key raises rate limits; no credentials are required."},"upstreamKey":{"type":"apiKey","in":"header","name":"X-Upstream-Key","description":"Your own key for the service this connector wraps (bring your own key). Used for that one call only; never stored, logged or cached."}},"schemas":{"Error":{"type":"object","properties":{"ok":{"const":false},"error":{"type":"object"}}}}},"paths":{"/v1/tools/get_current_user":{"post":{"operationId":"get_current_user","summary":"Show the Sourcegraph.com user the token belongs to: username, display name, profile link, creation date and site admin f","description":"Show the Sourcegraph.com user the token belongs to: username, display name, profile link, creation date and site admin flag. Use for \"Which Sourcegraph account is my token connected to\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{},"title":"get_current_userArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/search_code":{"post":{"operationId":"search_code","summary":"Run a Sourcegraph code search query and return matching files with line previews, matching commits or repositories. Supp","description":"Run a Sourcegraph code search query and return matching files with line previews, matching commits or repositories. Supports Sourcegraph query syntax such as 'repo:^github\\.com/org/ lang:go count:20 pattern'. Use for \"Find Go files that call http.ListenAndServe in the sourcegraph/sourcegraph repository\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"query":{"description":"Sourcegraph search query, for example 'repo:^github\\.com/sourcegraph/sourcegraph$ lang:go ListenAndServe count:20'. Use count:N to limit results.","maxLength":1000,"title":"Query","type":"string"},"pattern_type":{"anyOf":[{"enum":["standard","literal","regexp","structural","keyword"],"type":"string"},{"type":"null"}],"default":null,"description":"How the pattern is read: standard, literal, regexp, structural or keyword; leave empty for the instance default.","title":"Pattern Type"}},"required":["query"],"title":"search_codeArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/list_repositories":{"post":{"operationId":"list_repositories","summary":"List repositories Sourcegraph knows about, optionally filtered by a name search, with description, stars, language and v","description":"List repositories Sourcegraph knows about, optionally filtered by a name search, with description, stars, language and visibility. Cursor paginated. Use for \"Which repositories on Sourcegraph match 'kubernetes'\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"search":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}],"default":null,"description":"Only repositories whose name matches this text.","title":"Search"},"first":{"anyOf":[{"maximum":100,"minimum":1,"type":"integer"},{"type":"null"}],"default":20,"description":"How many items to return (1 to 100).","title":"First"},"after":{"anyOf":[{"maxLength":300,"type":"string"},{"type":"null"}],"default":null,"description":"Cursor from pageInfo.endCursor of the previous page; leave empty for the first page.","title":"After"}},"title":"list_repositoriesArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/get_repository":{"post":{"operationId":"get_repository","summary":"Get one repository by name: description, language, stars, topics, fork, archive and privacy flags, default branch and da","description":"Get one repository by name: description, language, stars, topics, fork, archive and privacy flags, default branch and dates. Use for \"What is the default branch and language of github.com/sourcegraph/sourcegraph on Sourcegraph\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"repository":{"description":"Full repository name as Sourcegraph lists it, for example 'github.com/sourcegraph/sourcegraph'.","maxLength":300,"title":"Repository","type":"string"}},"required":["repository"],"title":"get_repositoryArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/list_commits":{"post":{"operationId":"list_commits","summary":"List commits reachable from a revision of a repository, newest first, optionally limited to a path or a message search, ","description":"List commits reachable from a revision of a repository, newest first, optionally limited to a path or a message search, with author, date and subject. Use for \"What are the latest commits to cmd/frontend in github.com/sourcegraph/sourcegraph\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"repository":{"description":"Full repository name as Sourcegraph lists it, for example 'github.com/sourcegraph/sourcegraph'.","maxLength":300,"title":"Repository","type":"string"},"revision":{"description":"Branch, tag or commit to start from, for example 'main'.","maxLength":200,"title":"Revision","type":"string"},"path":{"anyOf":[{"maxLength":300,"type":"string"},{"type":"null"}],"default":null,"description":"Only commits that touched this file or directory path.","title":"Path"},"message_query":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}],"default":null,"description":"Only commits whose message matches this text.","title":"Message Query"},"first":{"anyOf":[{"maximum":100,"minimum":1,"type":"integer"},{"type":"null"}],"default":20,"description":"How many items to return (1 to 100).","title":"First"}},"required":["repository","revision"],"title":"list_commitsArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/list_directory":{"post":{"operationId":"list_directory","summary":"List the files and subdirectories at a path of a repository revision. Use for \"What files are in the cmd/frontend direct","description":"List the files and subdirectories at a path of a repository revision. Use for \"What files are in the cmd/frontend directory of github.com/sourcegraph/sourcegraph\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"repository":{"description":"Full repository name as Sourcegraph lists it, for example 'github.com/sourcegraph/sourcegraph'.","maxLength":300,"title":"Repository","type":"string"},"revision":{"description":"Branch, tag or commit to read, for example 'main'.","maxLength":200,"title":"Revision","type":"string"},"path":{"anyOf":[{"maxLength":300,"type":"string"},{"type":"null"}],"default":null,"description":"Directory path; leave empty for the repository root.","title":"Path"}},"required":["repository","revision"],"title":"list_directoryArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/read_file":{"post":{"operationId":"read_file","summary":"Read the text of one file of a repository revision, optionally only a line range. Large files are cut off by the connect","description":"Read the text of one file of a repository revision, optionally only a line range. Large files are cut off by the connector's size limit, so ask for a line range. Use for \"Show lines 1 to 40 of README.md in github.com/sourcegraph/sourcegraph\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"repository":{"description":"Full repository name as Sourcegraph lists it, for example 'github.com/sourcegraph/sourcegraph'.","maxLength":300,"title":"Repository","type":"string"},"revision":{"description":"Branch, tag or commit to read, for example 'main'.","maxLength":200,"title":"Revision","type":"string"},"path":{"description":"File path inside the repository, for example 'README.md'.","maxLength":300,"title":"Path","type":"string"},"start_line":{"anyOf":[{"maximum":10000000,"minimum":1,"type":"integer"},{"type":"null"}],"default":null,"description":"First line to return (1-based); leave empty for the start of the file.","title":"Start Line"},"end_line":{"anyOf":[{"maximum":10000000,"minimum":1,"type":"integer"},{"type":"null"}],"default":null,"description":"Last line to return; leave empty for the end of the file.","title":"End Line"}},"required":["repository","revision","path"],"title":"read_fileArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}},"/v1/tools/list_branches":{"post":{"operationId":"list_branches","summary":"List the branches of a repository with the commit each one points to, optionally filtered by name. Use for \"Which releas","description":"List the branches of a repository with the commit each one points to, optionally filtered by name. Use for \"Which release branches does github.com/sourcegraph/sourcegraph have\".","tags":["tools"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"repository":{"description":"Full repository name as Sourcegraph lists it, for example 'github.com/sourcegraph/sourcegraph'.","maxLength":300,"title":"Repository","type":"string"},"search":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}],"default":null,"description":"Only branches whose name matches this text.","title":"Search"},"first":{"anyOf":[{"maximum":100,"minimum":1,"type":"integer"},{"type":"null"}],"default":20,"description":"How many items to return (1 to 100).","title":"First"}},"required":["repository"],"title":"list_branchesArguments","type":"object"}}}},"responses":{"200":{"description":"Tool result. `ok: true` on success; `ok: false` with a structured `error` (provider_unavailable, upstream_error, bad_input) when the tool could not answer.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"422":{"description":"Arguments failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (see Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-read-only":true}}}}