getMock
Gets information about a mock server: collection UID and mock URL, for navigating to the source collection.
Instructions
Gets information about a mock server.
Resource: Mock server entity. Response includes the associated `collection` UID and `mockUrl`.
Use the `collection` UID to navigate back to the source collection.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mockId | Yes | The mock's ID. |
Implementation Reference
- src/tools/getMock.ts:17-43 (handler)The main handler function that executes the 'getMock' tool logic. It makes a GET request to /mocks/{mockId} using the Postman API client and returns the result as JSON text.
export async function handler( args: z.infer<typeof parameters>, extra: { client: PostmanAPIClient; headers?: IsomorphicHeaders; serverContext?: ServerContext } ): Promise<CallToolResult> { try { const endpoint = `/mocks/${args.mockId}`; const query = new URLSearchParams(); const url = query.toString() ? `${endpoint}?${query.toString()}` : endpoint; const options: any = { headers: extra.headers, }; const result = await extra.client.get(url, options); return { content: [ { type: 'text', text: `${typeof result === 'string' ? result : JSON.stringify(result, null, 2)}`, }, ], }; } catch (e: unknown) { if (e instanceof McpError) { throw e; } throw asMcpError(e); } } - src/tools/getMock.ts:9-9 (schema)Zod schema defining the input parameter: mockId (string).
export const parameters = z.object({ mockId: z.string().describe("The mock's ID.") }); - src/enabledResources.ts:82-83 (registration)Registration of 'getMock' in the 'full' enabled resources list.
'getMock', 'getMocks', - src/enabledResources.ts:192-193 (registration)Registration of 'getMock' in the 'minimal' enabled resources list.
'getMock', 'getMocks',