get_document_content
Retrieve full patent documents with chemical annotations using document IDs to access detailed chemical patent information from the SureChEMBL database.
Instructions
Get complete patent document content with chemical annotations by document ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| document_id | Yes | Patent document ID (e.g., WO-2020096695-A1) |
Implementation Reference
- src/index.ts:628-649 (handler)The handler function that validates input arguments, fetches patent document contents from the SureChEMBL API, and returns the content as formatted JSON.private async handleGetDocumentContent(args: any) { if (!isValidDocumentArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid document arguments'); } try { const response = await this.apiClient.get(`/document/${args.document_id}/contents`); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to get document content: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }
- src/index.ts:353-363 (registration)Registers the tool in the list returned by ListToolsRequest, including name, description, and input schema definition.{ name: 'get_document_content', description: 'Get complete patent document content with chemical annotations by document ID', inputSchema: { type: 'object', properties: { document_id: { type: 'string', description: 'Patent document ID (e.g., WO-2020096695-A1)' }, }, required: ['document_id'], }, },
- src/index.ts:356-362 (schema)Defines the input schema for the tool: object with required 'document_id' string property.inputSchema: { type: 'object', properties: { document_id: { type: 'string', description: 'Patent document ID (e.g., WO-2020096695-A1)' }, }, required: ['document_id'], },
- src/index.ts:104-114 (helper)Helper function for validating the tool's input arguments, checking for valid 'document_id' and optional 'include_annotations'.const isValidDocumentArgs = ( args: any ): args is { document_id: string; include_annotations?: boolean } => { return ( typeof args === 'object' && args !== null && typeof args.document_id === 'string' && args.document_id.length > 0 && (args.include_annotations === undefined || typeof args.include_annotations === 'boolean') ); };
- src/index.ts:546-547 (handler)Switch case in the main CallToolRequest handler that routes get_document_content calls to the specific handler function.case 'get_document_content': return await this.handleGetDocumentContent(args);