get_context tool parses the input into semantic phrases and matches each phrase to data entities (dimensions, measures, views) in your semantic model — searching against the #(doc) descriptions and #(index_values) annotations declared in your model. Your agent gets ranked entity matches and Malloy syntax guidance, so it can construct accurate queries without hallucinating field names or misunderstanding your data structure.
Looking to connect via OAuth? See LLMs and MCP Tools for connecting third-party AI tools like Claude Desktop or ChatGPT.
Authentication Setup
1. Create a Group
Navigate toyourorg.app.credibledata.com:
- Click Users & Groups in the bottom left of the sidebar
- Switch to the Groups tab
- Click + Create Group and name your group (e.g.,
ai_agents_group)
2. Grant Project Access
Navigate to the project you want this group to access:- Click Permissions on the project page
- Add your group and select the appropriate role
- Verify the group appears in the permissions list
3. Create an API Key (CLI)
Install the Credible CLI, authenticate, and generate an API key for your group:Security: Store the API key securely in your application’s credential storage or environment variables. Future API calls will act with the permissions of your assigned group. You can modify group permissions at any time without regenerating the token.
Connecting Your Agent
Using an MCP Client
Here’s an example using Mastra’s MCP client:transport: 'http'- Explicitly sets HTTP transport mode (required for remote connections)id- Unique identifier for this MCP client instanceurl- Replace<your-org>with your organization name in the URL- Environment Variables - Store your API key in environment variables for security (recommended for production)
timeout- Global timeout for all MCP operations in milliseconds
Authentication Header
All requests to the MCP server must include the API key in the Authorization header:Troubleshooting
Testing Your Connection with curl
You can verify your MCP connection using curl before integrating with your agent framework. These examples assume you have your API key stored in an environment variable:1. Test Connection (Initialize)
This verifies your authentication and establishes a connection:2. List Available Tools
Once connected, verify you can access the MCP tools:get_context and execute_query.
Available MCP Tools
Once connected, your agent has access to two tools:- get_context — Parses the user’s question into phrases, matches each phrase to data entities (dimensions, measures, views) in your semantic model, and returns ranked matches grounded in your model’s
#(doc)and#(index_values)annotations - execute_query — Executes Malloy queries against your semantic models and returns JSON results