MCP Usage Guide
Efficient patterns for AWS MCP tools to minimize tokens and maximize accuracy.
aws___search_documentation
Query Optimization
Good queries (specific, 2-5 words):
"Lambda cold start optimization"
"S3 bucket policy examples"
"DynamoDB single table design"
"ECS Fargate networking"
Bad queries (too vague or verbose):
"How do I make my Lambda faster" → Too conversational
"AWS" → Too broad
"I need to understand how to configure..." → Too verbose
Topic Selection Matrix
| User Says | Topic | Query Example |
|---|---|---|
| "How do I use SDK..." | reference_documentation |
"S3 PutObject SDK v3" |
| "What's new in..." | current_awareness |
"Lambda 2024 features" |
| "Getting error..." | troubleshooting |
"AccessDenied S3 GetObject" |
| "CDK how to..." | cdk_docs |
"CDK Lambda Python" |
| "CDK example..." | cdk_constructs |
"API Gateway Lambda CDK" |
| "CloudFormation..." | cloudformation |
"DynamoDB table template" |
| "Best practice..." | general |
"serverless security patterns" |
Multi-Topic Searches
Use multiple topics (max 3) when query spans areas:
# User: "How do I fix this Lambda timeout and what's the best practice?"
topics=["troubleshooting", "general"]
query="Lambda timeout"
# User: "Show me CDK examples and explain the concepts"
topics=["cdk_constructs", "cdk_docs"]
query="Lambda function CDK"
aws___read_documentation
When to Use
- Search returned snippet isn't enough
- Need complete code examples
- Need to understand full context
Pagination for Long Docs
# First call
aws___read_documentation(url="...", max_length=5000)
# If truncated, continue
aws___read_documentation(url="...", start_index=5000, max_length=5000)
Stop early if you found the answer - don't read entire doc.
aws___get_regional_availability
Query Patterns
Check service availability:
resource_type="product"
filters=["Amazon Aurora Serverless v2", "AWS AppSync"]
region="sa-east-1"
Check API availability:
resource_type="api"
filters=["Lambda+CreateFunction", "S3+PutObject"]
region="eu-west-1"
Check CloudFormation support:
resource_type="cfn"
filters=["AWS::Lambda::Function", "AWS::DynamoDB::GlobalTable"]
region="ap-southeast-1"
Common Use Cases
- Before recommending a service: Verify it's available in user's region
- Multi-region architectures: Check consistency across regions
- New features: Verify regional rollout status
aws___recommend
When to Use
- After reading a doc, find related content
- Discover "New" features for a service
- Find commonly-viewed-next pages
# Find new Lambda features
aws___recommend(url="https://docs.aws.amazon.com/lambda/latest/dg/welcome.html")
# Check "New" category in results
AWS Marketplace MCPs
ask_aws_marketplace
Use for third-party solution discovery:
# Good queries
"monitoring tools for Kubernetes"
"log management SOC2 compliant"
"compare Datadog vs New Relic"
# Bad queries
"AWS Lambda" → Use Knowledge MCP instead
"How do I..." → Not for how-to questions
Polling Pattern
# Initial call
response = ask_aws_marketplace(query="...")
# Poll until complete
while response.next_cursor:
response = ask_aws_marketplace(
last_request_id=response.request_id,
cursor=response.next_cursor
)
# Display each message immediately to user!
# Then get structured report
report = get_aws_marketplace_recommendations_report(last_request_id=response.request_id)
Token Optimization Tips
- Search before read: Search results often have enough context
- Specific queries: Fewer results = less to process
- Right topic: Avoid general when specific topic exists
- Stop early: Don't paginate if answer found
- Cache mentally: Don't re-search same thing in conversation