Skip to main content
Glama

AgentMode

Official
by agentmode
Bitbucket.json53.3 kB
{ "resources": [ { "server_url": "https://api.bitbucket.org/2.0", "path": "/repositories/{workspace}/{repo_slug}/src/{commit}/{path}", "method": "get", "parameters": [ { "name": "format", "in": "query", "description": "If 'meta' is provided, returns the (json) meta data for the contents of the file. If 'rendered' is provided, returns the contents of a non-binary file in HTML-formatted rendered markup. The 'rendered' option only supports these filetypes: `.md`, `.markdown`, `.mkd`, `.mkdn`, `.mdown`, `.text`, `.rst`, and `.textile`. Since Git does not generally track what text encoding scheme is used, this endpoint attempts to detect the most appropriate character encoding. While usually correct, determining the character encoding can be ambiguous which in exceptional cases can lead to misinterpretation of the characters. As such, the raw element in the response object should not be treated as equivalent to the file's actual contents.", "required": false, "schema": { "type": "string", "enum": [ "meta", "rendered" ] } }, { "name": "q", "in": "query", "description": "Optional filter expression as per [filtering and sorting](/cloud/bitbucket/rest/intro/#filtering).", "required": false, "schema": { "type": "string" } }, { "name": "sort", "in": "query", "description": "Optional sorting parameter as per [filtering and sorting](/cloud/bitbucket/rest/intro/#sorting-query-results).", "required": false, "schema": { "type": "string" } }, { "name": "max_depth", "in": "query", "description": "If provided, returns the contents of the repository and its subdirectories recursively until the specified max_depth of nested directories. When omitted, this defaults to 1.", "required": false, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "If the path matches a file, then the raw contents of the file are\nreturned. If the `format=meta` query parameter is provided,\na json document containing the file's meta data is\nreturned. If the `format=rendered` query parameter is provided,\nthe contents of the file in HTML-formated rendered markup is returned.\nIf the path matches a directory, then a paginated\nlist of file and directory entries is returned (if the\n`format=meta` query parameter was provided, then the json document\ncontaining the directory's meta data is returned.)\n", "content": { "application/json": { "schema": { "type": "object", "title": "Paginated Tree Entry", "description": "A paginated list of commit_file and/or commit_directory objects.", "properties": { "size": { "type": "integer", "description": "Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute.", "minimum": 0 }, "page": { "type": "integer", "description": "Page number of the current results. This is an optional element that is not provided in all responses.", "minimum": 1 }, "pagelen": { "type": "integer", "description": "Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values.", "minimum": 1 }, "next": { "type": "string", "description": "Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs.", "format": "uri" }, "previous": { "type": "string", "description": "Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs.", "format": "uri" }, "values": { "type": "array", "items": { "$ref": "#/components/schemas/treeentry" }, "minItems": 0, "uniqueItems": true } }, "additionalProperties": false } } } }, "404": { "description": "If the path or commit in the URL does not exist.", "content": { "application/json": { "schema": { "type": "object", "title": "Error", "description": "Base type for most resource objects. It defines the common `type` element that identifies an object's type. It also identifies the element as Swagger's `discriminator`.", "properties": { "type": { "type": "string" }, "error": { "type": "object", "properties": { "message": { "type": "string" }, "detail": { "type": "string" }, "data": { "type": "object", "description": "Optional structured data that is endpoint-specific.", "properties": {}, "additionalProperties": true } }, "required": [ "message" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": true } } } }, "555": { "description": "If the call times out, possibly because the specified recursion depth is too large.", "content": { "application/json": { "schema": { "type": "object", "title": "Error", "description": "Base type for most resource objects. It defines the common `type` element that identifies an object's type. It also identifies the element as Swagger's `discriminator`.", "properties": { "type": { "type": "string" }, "error": { "type": "object", "properties": { "message": { "type": "string" }, "detail": { "type": "string" }, "data": { "type": "object", "description": "Optional structured data that is endpoint-specific.", "properties": {}, "additionalProperties": true } }, "required": [ "message" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": true } } } } }, "request_body_parameters": {}, "description": "This endpoints is used to retrieve the contents of a single file,\nor the contents of a directory at a specified revision.\n\n#### Raw file contents\n\nWhen `path` points to a file, this endpoint returns the raw contents.\nThe response's Content-Type is derived from the filename\nextension (not from the contents). The file contents are not processed\nand no character encoding/recoding is performed and as a result no\ncharacter encoding is included as part of the Content-Type.\n\nThe `Content-Disposition` header will be \"attachment\" to prevent\nbrowsers from running executable files.\n\nIf the file is managed by LFS, then a 301 redirect pointing to\nAtlassian's media services platform is returned.\n\nThe response includes an ETag that is based on the contents of the file\nand its attributes. This means that an empty `__init__.py` always\nreturns the same ETag, regardless on the directory it lives in, or the\ncommit it is on.\n\n#### File meta data\n\nWhen the request for a file path includes the query parameter\n`?format=meta`, instead of returning the file's raw contents, Bitbucket\ninstead returns the JSON object describing the file's properties:\n\n```javascript\n$ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef/tests/__init__.py?format=meta\n{\n \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py\"\n },\n \"meta\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py?format=meta\"\n }\n },\n \"path\": \"tests/__init__.py\",\n \"commit\": {\n \"type\": \"commit\",\n \"hash\": \"eefd5ef5d3df01aed629f650959d6706d54cd335\",\n \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335\"\n },\n \"html\": {\n \"href\": \"https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335\"\n }\n }\n },\n \"attributes\": [],\n \"type\": \"commit_file\",\n \"size\": 0\n}\n```\n\nFile objects contain an `attributes` element that contains a list of\npossible modifiers. Currently defined values are:\n\n* `link` -- indicates that the entry is a symbolic link. The contents\n of the file represent the path the link points to.\n* `executable` -- indicates that the file has the executable bit set.\n* `subrepository` -- indicates that the entry points to a submodule or\n subrepo. The contents of the file is the SHA1 of the repository\n pointed to.\n* `binary` -- indicates whether Bitbucket thinks the file is binary.\n\nThis endpoint can provide an alternative to how a HEAD request can be\nused to check for the existence of a file, or a file's size without\nincurring the overhead of receiving its full contents.\n\n\n#### Directory listings\n\nWhen `path` points to a directory instead of a file, the response is a\npaginated list of directory and file objects in the same order as the\nunderlying SCM system would return them.\n\nFor example:\n\n```javascript\n$ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef/tests\n{\n \"pagelen\": 10,\n \"values\": [\n {\n \"path\": \"tests/test_project\",\n \"type\": \"commit_directory\",\n \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/\"\n },\n \"meta\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/?format=meta\"\n }\n },\n \"commit\": {\n \"type\": \"commit\",\n \"hash\": \"eefd5ef5d3df01aed629f650959d6706d54cd335\",\n \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335\"\n },\n \"html\": {\n \"href\": \"https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335\"\n }\n }\n }\n },\n {\n \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py\"\n },\n \"meta\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py?format=meta\"\n }\n },\n \"path\": \"tests/__init__.py\",\n \"commit\": {\n \"type\": \"commit\",\n \"hash\": \"eefd5ef5d3df01aed629f650959d6706d54cd335\",\n \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335\"\n },\n \"html\": {\n \"href\": \"https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335\"\n }\n }\n },\n \"attributes\": [],\n \"type\": \"commit_file\",\n \"size\": 0\n }\n ],\n \"page\": 1,\n \"size\": 2\n}\n```\n\nWhen listing the contents of the repo's root directory, the use of a\ntrailing slash at the end of the URL is required.\n\nThe response by default is not recursive, meaning that only the direct contents of\na path are returned. The response does not recurse down into\nsubdirectories. In order to \"walk\" the entire directory tree, the\nclient can either parse each response and follow the `self` links of each\n`commit_directory` object, or can specify a `max_depth` to recurse to.\n\nThe max_depth parameter will do a breadth-first search to return the contents of the subdirectories\nup to the depth specified. Breadth-first search was chosen as it leads to the least amount of\nfile system operations for git. If the `max_depth` parameter is specified to be too\nlarge, the call will time out and return a 555.\n\nEach returned object is either a `commit_file`, or a `commit_directory`,\nboth of which contain a `path` element. This path is the absolute path\nfrom the root of the repository. Each object also contains a `commit`\nobject which embeds the commit the file is on. Note that this is merely\nthe commit that was used in the URL. It is *not* the commit that last\nmodified the file.\n\nDirectory objects have 2 representations. Their `self` link returns the\npaginated contents of the directory. The `meta` link on the other hand\nreturns the actual `directory` object itself, e.g.:\n\n```javascript\n{\n \"path\": \"tests/test_project\",\n \"type\": \"commit_directory\",\n \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/\"\n },\n \"meta\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/?format=meta\"\n }\n },\n \"commit\": { ... }\n}\n```\n\n#### Querying, filtering and sorting\n\nLike most API endpoints, this API supports the Bitbucket\nquerying/filtering syntax and so you could filter a directory listing\nto only include entries that match certain criteria. For instance, to\nlist all binary files over 1kb use the expression:\n\n`size > 1024 and attributes = \"binary\"`\n\nwhich after urlencoding yields the query string:\n\n`?q=size%3E1024+and+attributes%3D%22binary%22`\n\nTo change the ordering of the response, use the `?sort` parameter:\n\n`.../src/eefd5ef/?sort=-size`\n\nSee [filtering and sorting](/cloud/bitbucket/rest/intro/#filtering) for more\ndetails.", "tags": [ "Source", "Repositories" ], "operationId": "get__repositories_workspace_repo_slug_src_commit_path" }, { "server_url": "https://api.bitbucket.org/2.0", "path": "/teams/{username}/search/code", "method": "get", "parameters": [ { "name": "username", "in": "path", "description": "The account to search in; either the username or the UUID in curly braces", "required": true, "schema": { "type": "string" } }, { "name": "search_query", "in": "query", "description": "The search query", "required": true, "schema": { "type": "string" } }, { "name": "page", "in": "query", "description": "Which page of the search results to retrieve", "required": false, "schema": { "type": "integer", "format": "int32", "default": 1 } }, { "name": "pagelen", "in": "query", "description": "How many search results to retrieve per page", "required": false, "schema": { "type": "integer", "format": "int32", "default": 10 } } ], "responses": { "200": { "description": "Successful search", "content": { "application/json": { "schema": { "type": "object", "properties": { "size": { "type": "integer", "format": "int64", "readOnly": true }, "page": { "type": "integer", "format": "int32", "readOnly": true }, "pagelen": { "type": "integer", "format": "int32", "readOnly": true }, "query_substituted": { "type": "boolean", "readOnly": true }, "next": { "type": "string", "format": "uri", "readOnly": true }, "previous": { "type": "string", "format": "uri", "readOnly": true }, "values": { "type": "array", "readOnly": true, "items": { "$ref": "#/components/schemas/search_code_search_result" } } } }, "examples": { "response": { "value": { "size": 1, "page": 1, "pagelen": 10, "query_substituted": false, "values": [ { "type": "code_search_result", "content_match_count": 2, "content_matches": [ { "lines": [ { "line": 2, "segments": [] }, { "line": 3, "segments": [ { "text": "def " }, { "text": "foo", "match": true }, { "text": "():" } ] }, { "line": 4, "segments": [ { "text": " print(\"snek\")" } ] }, { "line": 5, "segments": [] } ] } ], "path_matches": [ { "text": "src/" }, { "text": "foo", "match": true }, { "text": ".py" } ], "file": { "path": "src/foo.py", "type": "commit_file", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/my-workspace/demo/src/ad6964b5fe2880dbd9ddcad1c89000f1dbcbc24b/src/foo.py" } } } } ] } } } } } }, "400": { "description": "If the search request was invalid due to one of the\nfollowing reasons:\n\n* the specified type of target account doesn''t match the actual\naccount type;\n\n* malformed pagination properties;\n\n* missing or malformed search query, in the latter case an error\nkey will be returned in `error.data.key` property.\n", "content": { "application/json": { "schema": { "type": "object", "title": "Error", "description": "Base type for most resource objects. It defines the common `type` element that identifies an object's type. It also identifies the element as Swagger's `discriminator`.", "properties": { "type": { "type": "string" }, "error": { "type": "object", "properties": { "message": { "type": "string" }, "detail": { "type": "string" }, "data": { "type": "object", "description": "Optional structured data that is endpoint-specific.", "properties": {}, "additionalProperties": true } }, "required": [ "message" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": true } } } }, "404": { "description": "Search is not enabled for the requested team, navigate to [https://bitbucket.org/search](https://bitbucket.org/search) to turn it on", "content": { "application/json": { "schema": { "type": "object", "title": "Error", "description": "Base type for most resource objects. It defines the common `type` element that identifies an object's type. It also identifies the element as Swagger's `discriminator`.", "properties": { "type": { "type": "string" }, "error": { "type": "object", "properties": { "message": { "type": "string" }, "detail": { "type": "string" }, "data": { "type": "object", "description": "Optional structured data that is endpoint-specific.", "properties": {}, "additionalProperties": true } }, "required": [ "message" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": true } } } }, "429": { "description": "Too many requests, try again later", "content": { "application/json": { "schema": { "type": "object", "title": "Error", "description": "Base type for most resource objects. It defines the common `type` element that identifies an object's type. It also identifies the element as Swagger's `discriminator`.", "properties": { "type": { "type": "string" }, "error": { "type": "object", "properties": { "message": { "type": "string" }, "detail": { "type": "string" }, "data": { "type": "object", "description": "Optional structured data that is endpoint-specific.", "properties": {}, "additionalProperties": true } }, "required": [ "message" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": true } } } } }, "request_body_parameters": {}, "description": "Search for code in the repositories of the specified team.\n\nNote that searches can match in the file's text (`content_matches`),\nthe path (`path_matches`), or both.\n\nYou can use the same syntax for the search query as in the UI.\nE.g. to search for \"foo\" only within the repository \"demo\",\nuse the query parameter `search_query=foo+repo:demo`.\n\nSimilar to other APIs, you can request more fields using a\n`fields` query parameter. E.g. to get some more information about\nthe repository of matched files, use the query parameter\n`search_query=foo&fields=%2Bvalues.file.commit.repository`\n(the `%2B` is a URL-encoded `+`).\n\nTry `fields=%2Bvalues.*.*.*.*` to get an idea what's possible.\n", "tags": [ "Search" ], "operationId": "searchTeam" }, { "server_url": "https://api.bitbucket.org/2.0", "path": "/workspaces/{workspace}/search/code", "method": "get", "parameters": [ { "name": "workspace", "in": "path", "description": "The workspace to search in; either the slug or the UUID in curly braces", "required": true, "schema": { "type": "string" } }, { "name": "search_query", "in": "query", "description": "The search query", "required": true, "schema": { "type": "string" } }, { "name": "page", "in": "query", "description": "Which page of the search results to retrieve", "required": false, "schema": { "type": "integer", "format": "int32", "default": 1 } }, { "name": "pagelen", "in": "query", "description": "How many search results to retrieve per page", "required": false, "schema": { "type": "integer", "format": "int32", "default": 10 } } ], "responses": { "200": { "description": "Successful search", "content": { "application/json": { "schema": { "type": "object", "properties": { "size": { "type": "integer", "format": "int64", "readOnly": true }, "page": { "type": "integer", "format": "int32", "readOnly": true }, "pagelen": { "type": "integer", "format": "int32", "readOnly": true }, "query_substituted": { "type": "boolean", "readOnly": true }, "next": { "type": "string", "format": "uri", "readOnly": true }, "previous": { "type": "string", "format": "uri", "readOnly": true }, "values": { "type": "array", "readOnly": true, "items": { "$ref": "#/components/schemas/search_code_search_result" } } } }, "examples": { "response": { "value": { "size": 1, "page": 1, "pagelen": 10, "query_substituted": false, "values": [ { "type": "code_search_result", "content_match_count": 2, "content_matches": [ { "lines": [ { "line": 2, "segments": [] }, { "line": 3, "segments": [ { "text": "def " }, { "text": "foo", "match": true }, { "text": "():" } ] }, { "line": 4, "segments": [ { "text": " print(\"snek\")" } ] }, { "line": 5, "segments": [] } ] } ], "path_matches": [ { "text": "src/" }, { "text": "foo", "match": true }, { "text": ".py" } ], "file": { "path": "src/foo.py", "type": "commit_file", "links": { "self": { "href": "https://api.bitbucket.org/2.0/repositories/my-workspace/demo/src/ad6964b5fe2880dbd9ddcad1c89000f1dbcbc24b/src/foo.py" } } } } ] } } } } } }, "400": { "description": "If the search request was invalid due to one of the\nfollowing reasons:\n\n* the specified type of target account doesn''t match the actual\naccount type;\n\n* malformed pagination properties;\n\n* missing or malformed search query, in the latter case an error\nkey will be returned in `error.data.key` property.\n", "content": { "application/json": { "schema": { "type": "object", "title": "Error", "description": "Base type for most resource objects. It defines the common `type` element that identifies an object's type. It also identifies the element as Swagger's `discriminator`.", "properties": { "type": { "type": "string" }, "error": { "type": "object", "properties": { "message": { "type": "string" }, "detail": { "type": "string" }, "data": { "type": "object", "description": "Optional structured data that is endpoint-specific.", "properties": {}, "additionalProperties": true } }, "required": [ "message" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": true } } } }, "404": { "description": "Search is not enabled for the requested workspace, navigate to [https://bitbucket.org/search](https://bitbucket.org/search) to turn it on", "content": { "application/json": { "schema": { "type": "object", "title": "Error", "description": "Base type for most resource objects. It defines the common `type` element that identifies an object's type. It also identifies the element as Swagger's `discriminator`.", "properties": { "type": { "type": "string" }, "error": { "type": "object", "properties": { "message": { "type": "string" }, "detail": { "type": "string" }, "data": { "type": "object", "description": "Optional structured data that is endpoint-specific.", "properties": {}, "additionalProperties": true } }, "required": [ "message" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": true } } } }, "429": { "description": "Too many requests, try again later", "content": { "application/json": { "schema": { "type": "object", "title": "Error", "description": "Base type for most resource objects. It defines the common `type` element that identifies an object's type. It also identifies the element as Swagger's `discriminator`.", "properties": { "type": { "type": "string" }, "error": { "type": "object", "properties": { "message": { "type": "string" }, "detail": { "type": "string" }, "data": { "type": "object", "description": "Optional structured data that is endpoint-specific.", "properties": {}, "additionalProperties": true } }, "required": [ "message" ], "additionalProperties": false } }, "required": [ "type" ], "additionalProperties": true } } } } }, "request_body_parameters": {}, "description": "Search for code in the repositories of the specified workspace.\n\nNote that searches can match in the file's text (`content_matches`),\nthe path (`path_matches`), or both.\n\nYou can use the same syntax for the search query as in the UI.\nE.g. to search for \"foo\" only within the repository \"demo\",\nuse the query parameter `search_query=foo+repo:demo`.\n\nSimilar to other APIs, you can request more fields using a\n`fields` query parameter. E.g. to get some more information about\nthe repository of matched files, use the query parameter\n`search_query=foo&fields=%2Bvalues.file.commit.repository`\n(the `%2B` is a URL-encoded `+`).\n\nTry `fields=%2Bvalues.*.*.*.*` to get an idea what's possible.\n", "tags": [ "Search" ], "operationId": "searchWorkspace" } ], "tools": [] }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/agentmode/server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server