---
lang: en
title: 'API docs: context.invocationcontext'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/context
permalink: /doc/en/lb4/apidocs.context.invocationcontext.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [InvocationContext](./context.invocationcontext.md)

## InvocationContext class

InvocationContext represents the context to invoke interceptors for a method. The context can be used to access metadata about the invocation as well as other dependencies.

**Signature:**

```typescript
export declare class InvocationContext extends Context 
```
**Extends:** [Context](./context.context.md)

## Constructors

<table><thead><tr><th>

Constructor


</th><th>

Modifiers


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[(constructor)(parent, target, methodName, args, source)](./context.invocationcontext._constructor_.md)


</td><td>


</td><td>

Construct a new instance of `InvocationContext`


</td></tr>
</tbody></table>

## Properties

<table><thead><tr><th>

Property


</th><th>

Modifiers


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[args](./context.invocationcontext.args.md)


</td><td>

`readonly`


</td><td>

[InvocationArgs](./context.invocationargs.md)


</td><td>


</td></tr>
<tr><td>

[description](./context.invocationcontext.description.md)


</td><td>

`readonly`


</td><td>

string


</td><td>

Description of the invocation


</td></tr>
<tr><td>

[methodName](./context.invocationcontext.methodname.md)


</td><td>

`readonly`


</td><td>

string


</td><td>


</td></tr>
<tr><td>

[source?](./context.invocationcontext.source.md)


</td><td>

`readonly`


</td><td>

[InvocationSource](./context.invocationsource.md)<!-- -->&lt;unknown&gt; \| undefined


</td><td>

_(Optional)_


</td></tr>
<tr><td>

[target](./context.invocationcontext.target.md)


</td><td>

`readonly`


</td><td>

object


</td><td>


</td></tr>
<tr><td>

[targetClass](./context.invocationcontext.targetclass.md)


</td><td>

`readonly`


</td><td>

Function


</td><td>

The target class, such as `OrderController`


</td></tr>
<tr><td>

[targetName](./context.invocationcontext.targetname.md)


</td><td>

`readonly`


</td><td>

string


</td><td>

The target name, such as `OrderController.prototype.cancelOrder`


</td></tr>
</tbody></table>

## Methods

<table><thead><tr><th>

Method


</th><th>

Modifiers


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[assertMethodExists()](./context.invocationcontext.assertmethodexists.md)


</td><td>


</td><td>

Assert the method exists on the target. An error will be thrown if otherwise.


</td></tr>
<tr><td>

[invokeTargetMethod(options)](./context.invocationcontext.invoketargetmethod.md)


</td><td>


</td><td>

Invoke the target method with the given context


</td></tr>
<tr><td>

[toString()](./context.invocationcontext.tostring.md)


</td><td>


</td><td>


</td></tr>
</tbody></table>


