Skip to content

Added Tool Call and Tool Result to GetPrompt for in-context learning … #188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
13 changes: 13 additions & 0 deletions docs/specification/draft/server/prompts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ A prompt definition includes:
Messages in a prompt can contain:

- `role`: Either "user" or "assistant" to indicate the speaker
- `toolCall`: Example Tool Calls requested by the Assistant
- `toolResult`: Example Tool Results supplied by the Server (or User)
- `content`: One of the following content types:

#### Text Content
Expand Down Expand Up @@ -252,6 +254,17 @@ Embedded resources enable prompts to seamlessly incorporate server-managed conte
documentation, code samples, or other reference materials directly into the conversation
flow.

#### Example Tool Call

An example Tool Call requested by the Assistant, usually in response to a preceding User
message. The `id` provides a correlation to any provided results.

#### Example Tool Result

An example Tool Result supplied by the User (normally the MCP Server supplying the
prompt), usually in response to a preceding Assistant message. The `id` allows the Host
to correlate the example with its associated ExampleToolCall.

## Error Handling

Servers **SHOULD** return standard JSON-RPC errors for common failure cases:
Expand Down
58 changes: 54 additions & 4 deletions schema/draft/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions schema/draft/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,49 @@ export type Role = "user" | "assistant";
export interface PromptMessage {
role: Role;
content: ContentBlock;
/**
* Tool calls requested by the the Assistant.
* Should only be present if Role is Assistant
*/
toolCall?: ExampleToolCall[];
/**
* Tool calls results supplied by the User.
* Should only be present if Role is User (Host)
*/
toolResult?: ExampleToolResult[];
}

/**
* A tool call initiated by the assistant.
*/
export interface ExampleToolCall {
/**
* A unique identifier for this tool call.
* This ID is used to match tool calls with their results.
*/
id: string;

/**
* The name of the tool being called.
*/
request: CallToolRequest;

}

/**
* A result returned from a tool call.
*/
export interface ExampleToolResult {
/**
* The identifier of the tool call this is the result for.
* This correlates this Result with the Request.
*/
toolCallId: string;

/**
* The content returned from the tool.
*/
result: CallToolResult;
}

/**
Expand Down