### Maven: Example output Source: https://platform.claude.com/docs/pt-BR/get-started Example output from running the QuickStart program, showing a list of search strategies for renewable energy. ```text Here are some effective search strategies to find the latest developments in renewable energy: ## General Search Terms - "Renewable energy news 2025" - ... ``` -------------------------------- ### Bad Example: Assumes Installation Source: https://platform.claude.com/docs/pt-BR/agents-and-tools/agent-skills/best-practices Shows an incorrect approach where the skill assumes a package is installed without specifying dependencies. ```markdown "Use the pdf library to process the file." ``` -------------------------------- ### Good Example: Explicit about Dependencies Source: https://platform.claude.com/docs/pt-BR/agents-and-tools/agent-skills/best-practices Shows the correct approach: explicitly state the required package installation command and then use it in code. This example uses pypdf to read a PDF file. ```markdown "Install required package: `pip install pypdf` Then use it: ```python from pypdf import PdfReader reader = PdfReader("file.pdf") ```" ``` -------------------------------- ### Run Python ModeAgent example from repository root Source: https://platform.claude.com/docs/pt-BR/build-with-claude/mid-conversation-effort-example Starts the Python example from the directory where agents should work, such as the root of a repository to review. With fan-out mode on, the model explores with bash commands, dispatches the Workflow tool unprompted, and synthesizes subagent reports into a final answer. ```bash python orchestration_mode.py "Review this repository for flaky tests and propose fixes." ``` -------------------------------- ### Returns Examples - Response 200 Source: https://platform.claude.com/docs/pt-BR/api/admin/rbac_groups/list Another example response, identical to the previous one, provided under the Returns Examples section. ```json { "data": [ { "id": "rbac_group_012rppKaSVsmTo6NqRDXQXNF", "created_at": "2024-10-30T23:58:27.427722Z", "name": "Engineering", "roles": [ "rbac_role_016J8xVtKpDq3Wy9ZmN2hR4s" ], "source_type": "direct", "type": "rbac_group", "updated_at": "2024-10-30T23:58:27.427722Z" } ], "has_more": false, "next_page": "eyJjdXJzb3IiOiAicmJhY19ncm91cF8wMSJ9" } ``` -------------------------------- ### Install Go SDK (workaround) Source: https://platform.claude.com/docs/pt-BR/build-with-claude/claude-in-microsoft-foundry Install the standard Go SDK as a workaround since Foundry is not natively supported. ```bash # O SDK Go ainda não oferece suporte nativo ao Foundry (consulte os exemplos de # Autenticação para usar o SDK Go padrão como solução alternativa) go get github.com/anthropics/anthropic-sdk-go ``` -------------------------------- ### Quick start with advisor tool using Go Source: https://platform.claude.com/docs/pt-BR/agents-and-tools/tool-use/advisor-tool Use this Go code to create a message with the advisor tool. Requires the beta header 'advisor-tool-2026-03-01'. The example uses model 'claude-sonnet-5' as executor and 'claude-opus-5' as advisor. ```go client := anthropic.NewClient() response, err := client.Beta.Messages.New(context.TODO(), anthropic.BetaMessageNewParams{ Model: anthropic.ModelClaudeSonnet5, MaxTokens: 4096, Tools: []anthropic.BetaToolUnionParam{ {OfAdvisorTool20260301: &anthropic.BetaAdvisorTool20260301Param{ Model: anthropic.ModelClaudeOpus5, }}, }, Messages: []anthropic.BetaMessageParam{ anthropic.NewBetaUserMessage(anthropic.NewBetaTextBlock("Build a concurrent worker pool in Go with graceful shutdown.")), }, Betas: []anthropic.AnthropicBeta{ anthropic.AnthropicBetaAdvisorTool2026_03_01, }, }) if err != nil { log.Fatal(err) } fmt.Println(response) ``` -------------------------------- ### Quick start with advisor tool using CLI Source: https://platform.claude.com/docs/pt-BR/agents-and-tools/tool-use/advisor-tool Use this CLI command to create a message with the advisor tool. Requires the beta flag 'advisor-tool-2026-03-01'. The example uses model 'claude-sonnet-5' as executor and 'claude-opus-5' as advisor. ```bash ant beta:messages create --beta advisor-tool-2026-03-01 <<'YAML' model: claude-sonnet-5 max_tokens: 4096 tools: - type: advisor_20260301 name: advisor model: claude-opus-5 messages: - role: user content: Build a concurrent worker pool in Go with graceful shutdown. YAML ``` -------------------------------- ### List and delete file resources from a session (cURL, CLI, Python, TypeScript, C#, Go) Source: https://platform.claude.com/docs/pt-BR/managed-agents/files Lists all resources of a session using resources.list and deletes a resource using resources.delete. The cURL example shows both list and delete commands. The CLI example shows the list and delete commands. The Python example lists and deletes. The TypeScript example lists and deletes, filtering out memory_store entries. The C# example lists and deletes. The Go example lists and deletes with error handling. ```bash curl --fail-with-body -sS "${auth[@]}" \ "${base_url}/sessions/${session_id}/resources" \ | jq -r '.data[] | "\(.id) \(.type)"' curl --fail-with-body -sS "${auth[@]}" -X DELETE \ "${base_url}/sessions/${session_id}/resources/${resource_id}" >/dev/null ``` ```bash ant beta:sessions:resources list --session-id "$SESSION_ID" ant beta:sessions:resources delete \ --session-id "$SESSION_ID" \ --resource-id "$RESOURCE_ID" ``` ```python listed = client.beta.sessions.resources.list(session.id) for entry in listed.data: print(entry.id, entry.type) client.beta.sessions.resources.delete(resource.id, session_id=session.id) ``` ```typescript const listed = await client.beta.sessions.resources.list(session.id); for (const entry of listed.data) { if (entry.type !== "memory_store") { console.log(entry.id, entry.type); } } await client.beta.sessions.resources.delete(resource.id, { session_id: session.id, }); ``` ```csharp var listed = await client.Beta.Sessions.Resources.List(session.ID); await foreach (var entry in listed.Paginate()) { var type = entry.Match(repo => repo.Type, fileRes => fileRes.Type, memoryStore => memoryStore.Type); Console.WriteLine($"{entry.ID} {type}"); } await client.Beta.Sessions.Resources.Delete(resource.ID, new() { SessionID = session.ID }); ``` ```go listed, err := client.Beta.Sessions.Resources.List(ctx, session.ID, anthropic.BetaSessionResourceListParams{}) if err != nil { panic(err) } for _, entry := range listed.Data { fmt.Println(entry.ID, entry.Type) } if _, err := client.Beta.Sessions.Resources.Delete(ctx, resource.ID, anthropic.BetaSessionResourceDeleteParams{ SessionID: session.ID, }); err != nil { panic(err) } ``` -------------------------------- ### Install PHP SDK Source: https://platform.claude.com/docs/pt-BR/build-with-claude/claude-in-microsoft-foundry Install the Anthropic PHP SDK and Guzzle HTTP client. ```bash composer require "anthropic-ai/sdk" "guzzlehttp/guzzle:^7" ``` -------------------------------- ### Start services (macOS/Linux) Source: https://platform.claude.com/docs/pt-BR/agents-and-tools/mcp-tunnels/quickstart Starts the Docker Compose stack and checks logs for route and tunnel registration. ```bash docker compose up -d docker compose logs mcp-proxy | grep "route configured" docker compose logs cloudflared | grep "Registered tunnel connection" ``` -------------------------------- ### Install ant via Go Source: https://platform.claude.com/docs/pt-BR/cli-sdks-libraries/cli/quickstart Installs the `ant` CLI from source using `go install`. Requires Go 1.25 or later. The binary is placed in `$(go env GOPATH)/bin`. ```bash go install github.com/anthropics/anthropic-cli/cmd/ant@latest ``` -------------------------------- ### Get tunnel domain from Secret (kubectl) Source: https://platform.claude.com/docs/pt-BR/agents-and-tools/mcp-tunnels/deploy-helm Read the tunnel domain from the `mcp-tunnel` Secret after installation. The setup component stores the tunnel ID and domain in this Secret when `tunnel.id` is empty. Re-running the setup component reuses the stored tunnel ID and never creates a second tunnel. ```bash kubectl -n mcp-tunnel get secret mcp-tunnel \ -o jsonpath='{.data.tunnel-domain}' | base64 -d ``` -------------------------------- ### Python: Criar quickstart.py Source: https://platform.claude.com/docs/pt-BR/get-started Cria o arquivo `quickstart.py` para o código do exemplo (o conteúdo não é exibido na página). ```text Crie um arquivo chamado `quickstart.py`: ``` -------------------------------- ### Install C# AWS SDK Source: https://platform.claude.com/docs/pt-BR/build-with-claude/claude-platform-on-aws Install the Anthropic C# SDK for AWS using dotnet. ```bash dotnet add package Anthropic.Aws ``` -------------------------------- ### Install MCP tunnel Helm chart (helm install) Source: https://platform.claude.com/docs/pt-BR/agents-and-tools/mcp-tunnels/deploy-helm Install the MCP tunnel Helm chart with the specified version and values file. The setup component runs as a Helm pre-install hook Job, so `helm install` blocks until it completes; on success the Job is deleted automatically. If `helm install` fails with a hook error, see the troubleshooting section on setup component authentication failures. ```bash helm install mcp-tunnel \ oci://us-docker.pkg.dev/anthropic-public-registry/charts/mcp-tunnel \ --version 2.0.2 \ --namespace mcp-tunnel --create-namespace \ -f values.yaml ``` -------------------------------- ### PHP: Run quickstart.php Source: https://platform.claude.com/docs/pt-BR/get-started Executes the PHP quickstart script. ```bash php quickstart.php ``` -------------------------------- ### Install Java AWS SDK (Gradle and Maven) Source: https://platform.claude.com/docs/pt-BR/build-with-claude/claude-platform-on-aws Install the Anthropic Java AWS SDK using Gradle or Maven. The Gradle example uses Kotlin DSL, and the Maven example uses XML. ```kotlin implementation("com.anthropic:anthropic-java-aws:2.58.0") ``` ```xml com.anthropic anthropic-java-aws 2.58.0 ``` -------------------------------- ### Quick start: Create ClaudeLanguageModel and get a response Source: https://platform.claude.com/docs/pt-BR/cli-sdks-libraries/libraries/apple-foundation-models#authentication Create a ClaudeLanguageModel with an API key from the environment, start a session, and get a response. The model name is .sonnet5 and the API key is read from the ANTHROPIC_API_KEY environment variable. ```swift import FoundationModels import ClaudeForFoundationModels let model = ClaudeLanguageModel( name: .sonnet5, auth: .apiKey(ProcessInfo.processInfo.environment["ANTHROPIC_API_KEY"] ?? "") ) let session = LanguageModelSession(model: model) let response = try await session.respond(to: "Plan a 4-day trip to Buenos Aires.") print(response.content) ``` -------------------------------- ### Response 200 Example for Get Connector Usage Source: https://platform.claude.com/docs/pt-BR/api/beta/organization/analytics/connectors/list Example response for the GET /v1/organizations/analytics/connectors endpoint. Shows the structure of the BetaConnectorUsage object with metrics for chat, Claude Code, cowork, and Office products, plus user and RBAC fields. ```json { "data": [ { "chat_metrics": { "distinct_conversation_connector_used_count": 0 }, "claude_code_metrics": { "distinct_session_connector_used_count": 0 }, "connector_name": "connector_name", "cowork_metrics": { "distinct_session_connector_used_count": 0 }, "distinct_user_count": 0, "office_metrics": { "excel": { "distinct_session_connector_used_count": 0 }, "outlook": { "distinct_session_connector_used_count": 0 }, "powerpoint": { "distinct_session_connector_used_count": 0 }, "word": { "distinct_session_connector_used_count": 0 } }, "connector_display_name": "connector_display_name", "individual_auth_distinct_user_count": 0, "managed_auth_distinct_user_count": 0, "product": "product", "rbac_group_id": "rbac_group_id", "rbac_group_name": "rbac_group_name", "read_call_count": 0, "unclassified_call_count": 0, "user_id": "user_id", "write_call_count": 0 } ], "next_page": "next_page" } ``` -------------------------------- ### Java: Create QuickStart.java Source: https://platform.claude.com/docs/pt-BR/get-started Defines the main Java class for the quickstart. It uses the Anthropic Java SDK to send a message and print the response. Requires the SDK and Java 25. ```java import com.anthropic.client.okhttp.AnthropicOkHttpClient; import com.anthropic.models.messages.Message; import com.anthropic.models.messages.MessageCreateParams; import com.anthropic.models.messages.Model; static void main() { var client = AnthropicOkHttpClient.fromEnv(); var params = MessageCreateParams.builder() .model(Model.CLAUDE_OPUS_5) .maxTokens(1000) .addUserMessage( "What should I search for to find the latest developments in renewable energy?" ) .build(); Message message = client.messages().create(params); for (var block : message.content()) { block.text().ifPresent(textBlock -> IO.println(textBlock.text())); } } ``` -------------------------------- ### Ruby: Run quickstart.rb Source: https://platform.claude.com/docs/pt-BR/get-started Executes the Ruby quickstart script using bundle exec. ```bash bundle exec ruby quickstart.rb ``` -------------------------------- ### Maven: Compile and run QuickStart Source: https://platform.claude.com/docs/pt-BR/get-started Runs the QuickStart main class using Maven's exec plugin. This command compiles the project and executes the specified main class. ```bash mvn compile exec:java -Dexec.mainClass=QuickStart ``` -------------------------------- ### PHP: Create quickstart.php Source: https://platform.claude.com/docs/pt-BR/get-started Creates a PHP script that sends a message to the Claude model and prints the text response. ```php messages->create( model: Model::CLAUDE_OPUS_5, maxTokens: 1000, messages: [ [ 'role' => 'user', 'content' => 'What should I search for to find the latest developments in renewable energy?', ], ], ); foreach ($message->content as $block) { if ($block instanceof TextBlock) { echo $block->text . PHP_EOL; } } ``` -------------------------------- ### Response 200 example for get project details Source: https://platform.claude.com/docs/pt-BR/api/compliance/apps/projects/retrieve Example successful response (HTTP 200) from the GET /v1/compliance/apps/projects/{project_id} endpoint. Shows the project object with fields such as id, attachments_count, chats_count, created_at, deleted_at, description, instructions, is_private, name, organization_id, organization_uuid, updated_at, and user. ```json { "id": "claude_proj_01Nm7PqRsTuVwXyZaBcDeFgH", "attachments_count": 3, "chats_count": 14, "created_at": "2025-03-12T18:22:41.123456Z", "deleted_at": "2019-12-27T18:11:19.117Z", "description": "Planning and research for the Q3 launch", "instructions": "Focus on concise, actionable answers.", "is_private": true, "name": "Q3 Product Launch", "organization_id": "org_015eofRkKpogX7uDKUyvBTph", "organization_uuid": "a1b2c3d4-e5f6-4789-a012-3456789abcde", "updated_at": "2025-03-14T09:05:17.456789Z", "user": { "id": "user_01WCz1FkmYMm4gnmykNKUu3Q", "email_address": "jane.doe@example.com" } } ``` -------------------------------- ### cURL request for Get Artifact Activity Source: https://platform.claude.com/docs/pt-BR/api/beta/organization/analytics/artifacts/list Sends a GET request to /v1/organizations/analytics/artifacts with the required anthropic-version header and API key. No query parameters are included in this example. ```bash curl https://api.anthropic.com/v1/organizations/analytics/artifacts \ -H 'anthropic-version: 2023-06-01' \ -H "X-Api-Key: $ANTHROPIC_API_KEY" ``` -------------------------------- ### Executar o exemplo Python Source: https://platform.claude.com/docs/pt-BR/get-started Executa o arquivo quickstart.py que contém o código de exemplo Python. A saída esperada é uma lista de estratégias de busca para encontrar desenvolvimentos recentes em energia renovável. ```bash python quickstart.py ``` ```text Here are some effective search strategies to find the latest developments in renewable energy: ## General Search Terms - "Renewable energy news 2025" - ... ``` -------------------------------- ### Response 200 for get current organization Source: https://platform.claude.com/docs/pt-BR/api/admin-api/organization/get-me Example successful response from the GET /v1/organizations/me endpoint, showing the organization object with id, name, and type fields. ```json { "id": "12345678-1234-5678-1234-567812345678", "name": "Organization Name", "type": "organization" } ``` -------------------------------- ### GET /v1/organizations/analytics/plugins Source: https://platform.claude.com/docs/pt-BR/api/admin/analytics Retrieves per-plugin install and invocation usage for a given day, with pagination. ```APIDOC ## GET /v1/organizations/analytics/plugins ### Description Get per-plugin install + invocation usage for a given day, with pagination. ### Method GET ### Endpoint /v1/organizations/analytics/plugins ### Parameters #### Query Parameters - **date** (string) - Required - The day for which to retrieve usage. - **cursor** (string) - Optional - Cursor for pagination. ### Response #### Success Response (200) - **plugins** (array) - List of plugin usage objects. - **next_cursor** (string) - Cursor for the next page. #### Response Example { "plugins": [ { "plugin_id": "plugin_123", "install_count": 2, "invocation_count": 10 } ], "next_cursor": "cursor_abc" } ``` -------------------------------- ### Java: Create project directory Source: https://platform.claude.com/docs/pt-BR/get-started Creates the directory structure for a Java quickstart project. Requires JDK 25 or later and Gradle or Maven on the PATH. ```bash mkdir -p claude-quickstart/src/main/java && cd claude-quickstart ``` -------------------------------- ### Ruby: Create project and install SDK Source: https://platform.claude.com/docs/pt-BR/get-started Creates a new directory, initializes a Ruby bundle, and adds the anthropic gem. ```bash mkdir claude-quickstart && cd claude-quickstart bundle init bundle add anthropic ``` -------------------------------- ### Ruby: Create quickstart.rb Source: https://platform.claude.com/docs/pt-BR/get-started Creates a Ruby script that sends a message to the Claude model and prints the text response. ```ruby require "anthropic" client = Anthropic::Client.new message = client.messages.create( model: Anthropic::Model::CLAUDE_OPUS_5, max_tokens: 1000, messages: [ { role: "user", content: "What should I search for to find the latest developments in renewable energy?" } ] ) message.content.each do |block| puts block.text if block.type == :text end ``` -------------------------------- ### GET /v1/organizations/rbac_groups/{group_id} Source: https://platform.claude.com/docs/pt-BR/api/http/beta/organization/rbac_groups/retrieve This snippet documents the GET endpoint to retrieve an RBAC Group by its ID. It includes the path parameter, request example, and the full response schema with a sample response. ```APIDOC ## GET /v1/organizations/rbac_groups/{group_id} ### Description Retrieve an RBAC Group by ID. The RBAC Groups API is available to Claude Enterprise organizations only. ### Method GET ### Endpoint /v1/organizations/rbac_groups/{group_id} ### Parameters #### Path Parameters - **group_id** (string) - Required - ID of the RBAC Group. ### Request Example ``` curl https://api.anthropic.com/v1/organizations/rbac_groups/$GROUP_ID \ -H 'anthropic-version: 2023-06-01' \ -H "X-Api-Key: $ANTHROPIC_API_KEY" ``` ### Response #### Success Response (200) - **type** (string) - Object type. For RBAC Groups, this is always `"rbac_group"`. - **id** (string) - ID of the RBAC Group. - **created_at** (string) - RFC 3339 timestamp of when the RBAC Group was created. - **name** (string) - Name of the RBAC Group. Not uniqueness-enforced. - **roles** (array of string or null) - RBAC Role IDs attached to this RBAC Group. Role attachment is managed in the admin settings and is read-only on this API. `null` means role data was temporarily unavailable — retry to distinguish from an empty list. - **source_type** (string) - How the RBAC Group was created: `"direct"` for groups created directly (for example, in the organization's admin settings), `"scim"` for groups provisioned by the identity provider. - **updated_at** (string) - RFC 3339 timestamp of when the RBAC Group was last updated. #### Response Example ``` { "id": "rbac_group_012rppKaSVsmTo6NqRDXQXNF", "created_at": "2024-10-30T23:58:27.427722Z", "name": "Engineering", "roles": [ "rbac_role_016J8xVtKpDq3Wy9ZmN2hR4s" ], "source_type": "direct", "type": "rbac_group", "updated_at": "2024-10-30T23:58:27.427722Z" } ``` ``` -------------------------------- ### Configurar cliente com fromEnv() Source: https://platform.claude.com/docs/pt-BR/cli-sdks-libraries/sdks/java Configura o cliente usando propriedades do sistema ou variáveis de ambiente. As propriedades do sistema têm precedência sobre as variáveis de ambiente. ```java import com.anthropic.client.AnthropicClient; import com.anthropic.client.okhttp.AnthropicOkHttpClient; // Configura usando as propriedades de sistema `anthropic.apiKey`, `anthropic.authToken` e `anthropic.baseUrl` // Ou configura usando as variáveis de ambiente `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN` e `ANTHROPIC_BASE_URL` AnthropicClient client = AnthropicOkHttpClient.fromEnv(); ``` -------------------------------- ### GET /v1/organizations/workspaces/{workspace_id}/rate_limits Source: https://platform.claude.com/docs/pt-BR/api/admin/workspaces/rate_limits/list This snippet documents the GET endpoint for listing workspace rate limit overrides, including path and query parameters, request example, and response schema. ```APIDOC ## GET /v1/organizations/workspaces/{workspace_id}/rate_limits ### Description List the rate limit overrides configured for a workspace. Returns only the groups and limiter types that have an override at the workspace level. Groups without overrides inherit the organization limits and are not listed; use `GET /v1/organizations/rate_limits` to see them. ### Method GET ### Endpoint /v1/organizations/workspaces/{workspace_id}/rate_limits ### Parameters #### Path Parameters - **workspace_id** (string) - Required - The ID of the workspace. #### Query Parameters - **group_type** (string) - Optional - Filter by group type. One of: "batch", "files", "model_group", "skills", "token_count", "web_search". - **limit** (number) - Optional - Maximum number of items to return per page. Ranges from `1` to `1000`. When omitted, every remaining entry is returned in a single page and `next_page` is `null`. - **page** (string) - Optional - Opaque cursor from a previous response's `next_page`. ### Request Example ``` curl https://api.anthropic.com/v1/organizations/workspaces/$WORKSPACE_ID/rate_limits \ -H 'anthropic-version: 2023-06-01' \ -H "X-Api-Key: $ANTHROPIC_API_KEY" ``` ### Response #### Success Response (200) - **data** (array of BetaWorkspaceRateLimit) - Rate-limit entries for the workspace, one per group that has at least one override. - **type** (string) - Object type. Always `workspace_rate_limit` for workspace rate-limit entries. - **group_type** (string) - The kind of rate-limit group this entry represents. `model_group` entries apply to a family of models (listed in `models`); other values apply to an API-surface category and have `models` set to `null`. One of: "batch", "files", "model_group", "skills", "token_count", "web_search". - **limits** (array of BetaWorkspaceRateLimitValue) - The limiter values overridden for this group in this workspace. Limiter types without a workspace override are omitted and inherit the organization value. - **type** (string) - The limiter type (for example, `requests_per_minute` or `input_tokens_per_minute`). - **org_limit** (number or null) - The organization-level value for the same limiter type, for reference. `null` when the organization has no limit configured for this limiter type. - **value** (number) - The workspace-level override value for this limiter type. - **models** (array of string or null) - Model names this entry's limits apply to, including aliases. `null` when `group_type` is not `"model_group"`. - **rate_limit_id** (string) - The `id` of the RateLimit group this override applies to. - **workspace_id** (string) - ID of the Workspace this override applies to. - **next_page** (string or null) - Opaque cursor for the next page of results, or `null` when no entries remain beyond this response. #### Response Example ``` { "data": [ { "group_type": "batch", "limits": [ { "org_limit": 0, "type": "type", "value": 0 } ], "models": [ "string" ], "rate_limit_id": "rate_limit_id", "type": "workspace_rate_limit", "workspace_id": "workspace_id" } ], "next_page": "next_page" } ``` ``` -------------------------------- ### Get RBAC Role - Response 200 Source: https://platform.claude.com/docs/pt-BR/api/admin/rbac_roles/retrieve Example successful response from the Get RBAC Role endpoint, returning a BetaRBACRole object with fields: id, created_at, name, type, and updated_at. ```json { "id": "rbac_role_016J8xVtKpDq3Wy9ZmN2hR4s", "created_at": "2024-10-30T23:58:27.427722Z", "name": "Project Editor", "type": "rbac_role", "updated_at": "2024-10-30T23:58:27.427722Z" } ``` -------------------------------- ### Create hello_server.py (macOS/Linux) Source: https://platform.claude.com/docs/pt-BR/agents-and-tools/mcp-tunnels/quickstart Creates a simple MCP server with a hello tool. Uses a here-document to write the file. ```bash cat > hello_server.py <<'EOF' from mcp.server.fastmcp import FastMCP mcp = FastMCP("hello") @mcp.tool() def hello(name: str = "world") -> str: """Say hello to someone.""" return f"Hello, {name}!" if __name__ == "__main__": mcp.run(transport="streamable-http") EOF ``` -------------------------------- ### Get Activity Summaries Response 200 Source: https://platform.claude.com/docs/pt-BR/api/beta/organization/analytics/retrieve_summaries Example 200 response for GET /v1/organizations/analytics/summaries. Contains a summaries array with per-day activity metrics such as active user counts, adoption rates, and seat counts. ```json { "summaries": [ { "assigned_seat_count": 0, "cowork_daily_active_user_count": 0, "cowork_monthly_active_user_count": 0, "cowork_weekly_active_user_count": 0, "daily_active_user_count": 0, "daily_adoption_rate": 0, "ending_at": "2019-12-27T18:11:19.117Z", "monthly_active_user_count": 0, "monthly_adoption_rate": 0, "pending_invite_count": 0, "starting_at": "2019-12-27T18:11:19.117Z", "weekly_active_user_count": 0, "weekly_adoption_rate": 0, "chat_daily_active_user_count": 0, "chat_monthly_active_user_count": 0, "chat_weekly_active_user_count": 0, "claude_code_daily_active_user_count": 0, "claude_code_monthly_active_user_count": 0, "claude_code_weekly_active_user_count": 0, "claude_design_daily_active_user_count": 0, "claude_design_monthly_active_user_count": 0, "claude_design_weekly_active_user_count": 0, "office_agent_daily_active_user_count": 0, "office_agent_monthly_active_user_count": 0, "office_agent_weekly_active_user_count": 0, "science_daily_active_user_count": 0, "science_entitled_user_count": 0, "science_monthly_active_user_count": 0, "science_weekly_active_user_count": 0 } ] } ``` -------------------------------- ### Response 200 for GET /v1/organizations/analytics/plugins Source: https://platform.claude.com/docs/pt-BR/api/beta/organization/analytics/plugins/list Example 200 response showing the BetaPluginUsage object with plugin metrics and pagination. ```json { "data": [ { "claude_code_metrics": { "distinct_session_plugin_used_count": 0 }, "cowork_metrics": { "distinct_session_plugin_used_count": 0 }, "distinct_user_count": 0, "install_count": 0, "invocation_count": 0, "plugin_name": "plugin_name", "plugin_id": "plugin_id", "product": "product", "rbac_group_id": "rbac_group_id", "rbac_group_name": "rbac_group_name", "user_id": "user_id" } ], "next_page": "next_page" } ``` -------------------------------- ### Progress notes example (progress.txt) Source: https://platform.claude.com/docs/pt-BR/build-with-claude/prompt-engineering/claude-prompting-best-practices Unstructured text format for tracking progress across sessions, including notes on fixes and next steps. ```text // Progress notes (progress.txt) Session 3 progress: - Fixed authentication token validation - Updated user model to handle edge cases - Next: investigate user_management test failures (test #2) - Note: Do not remove tests as this could lead to missing functionality ``` -------------------------------- ### SKILL.md instructions with pdfplumber example Source: https://platform.claude.com/docs/pt-BR/agents-and-tools/agent-skills/overview Main body of a SKILL.md file containing procedural knowledge. It includes a quick start section with a Python example using pdfplumber to extract text from a PDF, and a link to FORMS.md for advanced form filling. ```markdown # PDF Processing ## Quick start Use pdfplumber to extract text from PDFs: ```python import pdfplumber with pdfplumber.open("document.pdf") as pdf: text = pdf.pages[0].extract_text() ``` For advanced form filling, see [FORMS.md](FORMS.md). ``` -------------------------------- ### Instalar helpers MCP em Go Source: https://platform.claude.com/docs/pt-BR/agents-and-tools/mcp-connector Obtém o subpacote `mcp` do SDK Go, que se baseia no MCP Go SDK. ```bash go get github.com/anthropics/anthropic-sdk-go/mcp ``` -------------------------------- ### GET /v1/organizations/analytics/plugins Source: https://platform.claude.com/docs/pt-BR/api/beta/organization/analytics/plugins/list Retrieves per-plugin install and invocation usage for a given day or date range, with pagination and optional grouping and filtering. ```APIDOC ## GET /v1/organizations/analytics/plugins ### Description Get per-plugin install + invocation usage for a given day, with pagination. Returns plugin usage metrics for the organization across Cowork and Claude Code, sorted by plugin name. The `plugin_name` value `third-party` is an aggregate bucket, not a plugin: it collects plugin activity, from either surface, for which the reporting client did not provide a plugin name — so an organization's own plugins can contribute both to their own named rows and to this bucket. Use `group_by[]` to break usage out per member, per RBAC group, or per product surface (Cowork / Claude Code), and `filter[]` to scope results; the parameter descriptions list the supported dimensions. Requires an API key with the `read:analytics` scope. `starting_date` / `ending_date` select range-rollup mode like `/skills`. ### Method GET ### Endpoint /v1/organizations/analytics/plugins ### Parameters #### Query Parameters - **date** (string) - Optional - UTC date in YYYY-MM-DD format. The day to get plugin usage for. Data is typically available with a 1-day lag (varies by query; the error for a too-recent date names the latest available day) and may be revised by a few percent over the following days. No earlier than 2026-01-01. - **ending_date** (string) - Optional - UTC date in YYYY-MM-DD format. End of the date range (exclusive); only valid with `starting_date`. Data is typically available with a 1-day lag (varies by query; the error for a too-recent date names the latest available day), so this can be at most today — which is also the default when omitted, resolved once when the first page is served and reused for the rest of the pagination sequence. At most 366 days after `starting_date`. - **filter** (array of string) - Optional - Filters as `dimension:value`, e.g. `filter[]=rbac_group_id:{id}`. Repeat the param for OR within a dimension and across dimensions for AND. Supported dimensions on this endpoint: `plugin_name`, `product`, `rbac_group_id`, `user_id`. Value forms: `plugin_name` matches case-insensitively; `product` is `claude_code` or `cowork` (the only surfaces with plugin attribution); `rbac_group_id` takes the tagged id (`rbac_group_...`, as emitted in responses and by the spend-limits API) or a bare group UUID, and matches users who held the group at any point during each covered UTC day (time-of-usage attribution); `user_id` takes a tagged user id (`user_...`), as emitted in responses. An unsupported dimension returns 400. At most 100 entries. - **group_by** (array of "product" or "rbac_group_id" or "user_id") - Optional - Dimensions to break results out by (e.g. `group_by[]=user_id`). Supported on this endpoint: `product`, `rbac_group_id`, `user_id`. On this endpoint `product` takes the values `claude_code` or `cowork` only (the surfaces with plugin attribution). Grouped rows carry the requested dimension values as additional fields and paginate like ungrouped responses via `next_page`; an unsupported dimension returns 400. `rbac_group_id` attributes a user to every group they held at any point during each covered UTC day, so grouped rows are not an exclusive partition and can sum above org-level totals. At most 100 entries. - **limit** (number) - Optional - Number of results per page (1-1000, default 100). - **order** ("asc" or "desc") - Optional - Sort direction: `asc` or `desc`. Defaults to `asc` for the endpoint's sort column and to `desc` when `order_by` names a metric (a top-N ranking). Applies to `order_by`, or to the endpoint's default sort field when `order_by` is omitted. - **order_by** (string) - Optional - Sort field. Restricted to the endpoint's sort column plus its rankable metrics (metrics default to descending; a few metrics rank in date-range mode only, per the endpoint's documented orderable set). - **page** (string) - Optional - Opaque cursor from a previous response's `next_page` field. - **starting_date** (string) - Optional - UTC date in YYYY-MM-DD format. Start of a date range (inclusive). Enables rollup mode: one row per entity aggregated over the whole range — addable counters are summed across days, and a distinct count is never summed where summing could double-count (a field's range value is recomputed exactly over the window, approximate via HLL with typical error under 2%, null, or — for the creation-event counts, whose per-day values cannot overlap — a per-day sum that is itself exact; each field's own description says which). Use either `date` or `starting_date`, not both. Data is typically available with a 1-day lag (varies by query; the error for a too-recent date names the latest available day) and may be revised by a few percent over the following days. No earlier than 2026-01-01. ### Request Example No request body is required for this endpoint. ### Response #### Success Response (200) The response contains plugin usage metrics, including pagination via `next_page`. Specific response fields are not documented in the source. #### Response Example No response example is provided in the source. ``` -------------------------------- ### Response 200 for Get Cost Report Source: https://platform.claude.com/docs/pt-BR/api/admin-api/usage-cost/get-cost-report Example JSON response from the Get Cost Report endpoint. It shows a data array with cost results, including fields like amount, model, and workspace_id, plus pagination fields has_more and next_page. ```json { "data": [ { "ending_at": "2025-08-02T00:00:00Z", "results": [ { "amount": "123.78912", "context_window": "0-200k", "cost_type": "tokens", "currency": "USD", "description": "Claude Opus 5 Usage - Input Tokens", "inference_geo": "global", "model": "claude-opus-5", "service_tier": "standard", "token_type": "uncached_input_tokens", "workspace_id": "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ" } ], "starting_at": "2025-08-01T00:00:00Z" } ], "has_more": true, "next_page": "page_MjAyNS0wNS0xNFQwMDowMDowMFo=" } ``` -------------------------------- ### Go quickstart: Use OpenAI SDK with Claude Source: https://platform.claude.com/docs/pt-BR/cli-sdks-libraries/libraries/openai-sdk Configure the OpenAI client with your Anthropic API key and base URL, then call the chat completions endpoint with the claude-opus-5 model. ```go package main import ( "context" "fmt" "os" "github.com/openai/openai-go/v3" "github.com/openai/openai-go/v3/option" ) func main() { client := openai.NewClient( option.WithAPIKey(os.Getenv("ANTHROPIC_API_KEY")), // Your Claude API key option.WithBaseURL("https://api.anthropic.com/v1/"), // the Claude API endpoint ) response, err := client.Chat.Completions.New(context.Background(), openai.ChatCompletionNewParams{ Model: "claude-opus-5", // Claude model name Messages: []openai.ChatCompletionMessageParamUnion{ openai.SystemMessage("You are a helpful assistant."), openai.UserMessage("Who are you?"), }, }) if err != nil { panic(err) } fmt.Println(response.Choices[0].Message.Content) } ``` -------------------------------- ### Tool definition for get_stock_price Source: https://platform.claude.com/docs/pt-BR/api/beta/messages/count_tokens Example of a tools array with a single tool definition for getting stock prices, including input schema with required ticker. ```json [ { "name": "get_stock_price", "description": "Get the current stock price for a given ticker symbol.", "input_schema": { "type": "object", "properties": { "ticker": { "type": "string", "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." } }, "required": ["ticker"] } } ] ``` -------------------------------- ### Executar o componente de setup Source: https://platform.claude.com/docs/pt-BR/agents-and-tools/mcp-tunnels/deploy-compose Executa o componente de setup via Docker Compose. O comando é idempotente e reutiliza o ID do túnel e a CA existentes. ```bash docker compose run --rm setup ``` -------------------------------- ### Instalar SDK C# para Vertex Source: https://platform.claude.com/docs/pt-BR/build-with-claude/claude-on-vertex-ai Adiciona o pacote Anthropic.Vertex via dotnet. ```bash dotnet add package Anthropic.Vertex ``` -------------------------------- ### GET /v1/organizations/analytics/plugins Source: https://platform.claude.com/docs/pt-BR/api/http/beta/organization/analytics/plugins Retrieves per-plugin install and invocation usage for a given day, with pagination. Returns a BetaPluginUsage object containing the usage data and a pagination token. ```APIDOC ## GET /v1/organizations/analytics/plugins ### Description Get per-plugin install + invocation usage for a given day, with pagination. ### Method GET ### Endpoint /v1/organizations/analytics/plugins ### Response #### Success Response (200) - **data** (array) - The usage data for each plugin. - **next_page** (string) - Pagination token for the next page of results. #### Response Example { "data": [], "next_page": "string" } ``` -------------------------------- ### Go: Define get_weather tool with InputExamples Source: https://platform.claude.com/docs/pt-BR/agents-and-tools/tool-use/define-tools Creates an Anthropic client and sends a message with a 'get_weather' tool definition, using InputSchema and InputExamples. The example shows how to use map[string]any for properties and demonstrate optional 'unit' by omitting it in an input example. ```Go client := anthropic.NewClient() response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{ Model: anthropic.ModelClaudeOpus5, MaxTokens: 1024, Tools: []anthropic.ToolUnionParam{ {Of: &anthropic.ToolParam{ Name: "get_weather", Description: anthropic.String("Get the current weather in a given location"), InputSchema: anthropic.ToolInputSchemaParam{ Properties: map[string]any{ "location": map[string]any{ "type": "string", "description": "The city and state, e.g. San Francisco, CA", }, "unit": map[string]any{ "type": "string", "enum": []string{"celsius", "fahrenheit"}, "description": "The unit of temperature", }, }, Required: []string{"location"}, }, InputExamples: []map[string]any{ { "location": "San Francisco, CA", "unit": "fahrenheit", }, { "location": "Tokyo, Japan", "unit": "celsius", }, { "location": "New York, NY", // Demonstra que 'unit' é opcional }, }, }}, }, Messages: []anthropic.MessageParam{ anthropic.NewUserMessage(anthropic.NewTextBlock("What's the weather like in San Francisco?")), }, }) if err != nil { log.Fatal(err) } fmt.Println(response.RawJSON()) ``` -------------------------------- ### Get Messages Usage Report - Response 200 Source: https://platform.claude.com/docs/pt-BR/api/admin-api/usage-cost/get-messages-usage-report Example 200 response from the Get Messages Usage Report endpoint. The response contains a data array with usage details per workspace, including token counts, model, and service tier, plus pagination fields has_more and next_page. ```json { "data": [ { "ending_at": "2025-08-02T00:00:00Z", "results": [ { "account_id": "user_01WCz1FkmYMm4gnmykNKUu3Q", "api_key_id": "apikey_01Rj2N8SVvo6BePZj99NhmiT", "cache_creation": { "ephemeral_1h_input_tokens": 0, "ephemeral_5m_input_tokens": 0 }, "cache_read_input_tokens": 200, "context_window": "0-200k", "inference_geo": "global", "model": "claude-opus-5", "output_tokens": 500, "server_tool_use": { "web_search_requests": 10 }, "service_account_id": "svac_01Hk3R9TWxq7CfQak00OiVw4", "service_tier": "standard", "uncached_input_tokens": 1500, "workspace_id": "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ" } ], "starting_at": "2025-08-01T00:00:00Z" } ], "has_more": true, "next_page": "page_MjAyNS0wNS0xNFQwMDowMDowMFo=" } ``` -------------------------------- ### Instalar o SDK com extras para plataformas e aiohttp Source: https://platform.claude.com/docs/pt-BR/cli-sdks-libraries/sdks/python Instala o SDK com extras para integrações específicas de plataforma ou melhor desempenho assíncrono. O suporte ao Microsoft Foundry está incluído no pacote base. ```bash # Para suporte ao Amazon Bedrock pip install "anthropic[bedrock]" # Para suporte ao Google Cloud pip install "anthropic[vertex]" # Para suporte ao Claude Platform na AWS pip install "anthropic[aws]" # O suporte ao Microsoft Foundry está incluído no pacote base # Para melhor desempenho assíncrono com aiohttp pip install "anthropic[aiohttp]" ``` -------------------------------- ### Instalar SDK Go para Vertex Source: https://platform.claude.com/docs/pt-BR/build-with-claude/claude-on-vertex-ai Obtém o SDK da Anthropic para Go via go get. ```bash go get github.com/anthropics/anthropic-sdk-go ``` -------------------------------- ### Criar projeto e instalar SDK Go Source: https://platform.claude.com/docs/pt-BR/get-started Cria um novo módulo e adiciona o SDK da Anthropic para Go. ```bash mkdir claude-quickstart && cd claude-quickstart go mod init claude-quickstart go get github.com/anthropics/anthropic-sdk-go ```