Ruletypescript
Api Rule
paths:
API Development
Tool Registration Pattern
server.registerTool(
'tool_name',
{ title: 'Title', description: 'Desc', inputSchema: zodSchema },
this.call(this.service.method.bind(this.service))
);
Response Format
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }]
};
Error Format
return {
content: [{ type: 'text', text: JSON.stringify({ error: message }) }],
isError: true
};
Timestamp Handling
- Most endpoints: ISO 8601 (
2024-01-01T00:00:00Z) - Product Candles: Unix timestamps only - use
isoToUnixfromschema.helpers.ts
Adding New Tool
- Check Coinbase SDK docs for endpoint
- Create or update service in
services/{ServiceName}.ts - Define request schema in
services/{ServiceName}.request.ts:- Use
{MethodName}RequestSchemanaming - Use
numberToStringhelpers for numeric fields - Add
.describe()to all fields and the schema itself
- Use
- Define response schema in
services/{ServiceName}.response.ts:- Use
{MethodName}ResponseSchemanaming - Use
stringToNumberhelpers for numeric fields - Add
.describe()to all fields and the schema itself
- Use
- Register tool in
tools/{Domain}ToolRegistry.ts:- Clear title and description
- Use
{MethodName}RequestSchema.shapefor inputSchema - Call pattern:
this.call(this.service.method.bind(this.service))
- Wrap SDK call in try-catch with meaningful error
- Write tests (100% coverage) - mock service responses
- Update
docs/IMPLEMENTED_TOOLS.mdincl. tool count - Update
README.mdincl. tool count - Update
src/server/CoinbaseMcpServer.tsassist prompt incl. tool count - Update
CLAUDE.mdincl. tool count
Rate Limits
- Public endpoints: 10 requests/second
- Private endpoints: 15 requests/second
- Consider caching product lists and static data
- Use batch endpoints when available